function testExcelQueryPrinter() { $params = array(); $context = SMWQueryProcessor::INLINE_QUERY; $format = "exceltable"; $extraprintouts = array(); $querystring = "[[Category:Car]]"; $query = SMWQueryProcessor::createQuery($querystring, $params, $context, $format, $extraprintouts); $res = smwfGetStore()->getQueryResult($query); $result = SMWQueryProcessor::getResultFromQuery($query, $params, $extraprintouts, SMW_OUTPUT_FILE, $context, $format); $this->assertFileContentsIgnoringWhitespaces("testcases/resources/excel_qp_result.dat", $result); }
/** * Method for handling the show parser function. * * @since 1.5.3 * * @param Parser $parser */ public static function render(Parser &$parser) { global $smwgQEnabled, $smwgIQRunningNumber, $wgTitle; if ($smwgQEnabled) { $smwgIQRunningNumber++; $rawParams = func_get_args(); array_shift($rawParams); // We already know the $parser ... list($query, $params) = SMWQueryProcessor::getQueryAndParamsFromFunctionParams($rawParams, SMW_OUTPUT_WIKI, SMWQueryProcessor::INLINE_QUERY, true); $result = SMWQueryProcessor::getResultFromQuery($query, $params, SMW_OUTPUT_WIKI, SMWQueryProcessor::INLINE_QUERY); $queryKey = hash('md4', implode('|', $rawParams), false); SMWAsk::addQueryData($queryKey, $query, $params, $parser); } else { $result = smwfEncodeMessages(array(wfMessage('smw_iq_disabled')->inContentLanguage()->text())); } if (!is_null($wgTitle) && $wgTitle->isSpecialPage()) { global $wgOut; SMWOutputs::commitToOutputPage($wgOut); } else { SMWOutputs::commitToParser($parser); } return $result; }
public static function getResultFromQueryString($querystring, $params, $extraprintouts, $outputmode, $context = SMWQueryProcessor::INLINE_QUERY) { $format = SMWQueryProcessor::getResultFormat($params); $query = SMWSPARQLQueryProcessor::createQuery($querystring, $params, $context, $format, $extraprintouts); $result = SMWQueryProcessor::getResultFromQuery($query, $params, $extraprintouts, $outputmode, $context, $format); return $result; }