function execute($par) { global $wgOut, $wgParser; $this->setHeaders(); $pars = explode('/', str_replace('\\', ' ', $par)); $type = array_shift($pars); $value = array_shift($pars); $argv = array(); foreach ($pars as $arg) { $subarg = explode('=', $arg); $argv[$subarg[0]] = $subarg[1]; } $argv['cache'] = 'on'; $argv['preexpand'] = 'false'; $argv['expand'] = 'false'; if (strtolower($type) == 'sql') $wgOut->addHTML(SQL2Wiki::renderSQL($value, $argv, $wgParser, null)); elseif (strtolower($type) == 'plsql') $wgOut->addHTML(SQL2Wiki::renderPLSQL($value, $argv, $wgParser, null)); else $wgOut->addWikiText('<b>'.wfMsg('sql2wiki-err-invalid_type').'</b>'); }
public static function renderPLSQL( $input, $args, $parser, $frame ) { try { $s2w = new SQL2Wiki( $args, true ); if ( !$s2w->isPLSQLSupported() ) { return wfMsgForContent( 'sql2wiki-err-feature_not_supported', $s2w->getDBType() ); } $sql = ( $s2w->shouldPreexpand() ) ? $parser->recursiveTagParse( $input ) : $input; if ( !$s2w->execute( $sql ) ) { return $s2w->mError; } $ret = $s2w->parseInline(); $ret = ( $s2w->shouldExpand() ) ? $parser->recursiveTagParse( $ret ) : $ret; $ret .= $s2w->handleCache( $parser ); return $ret; } catch ( Exception $ex ) { return $ex->getMessage(); } }