本文整理汇总了PHP中SMWQueryResult::setCountValue方法的典型用法代码示例。如果您正苦于以下问题:PHP SMWQueryResult::setCountValue方法的具体用法?PHP SMWQueryResult::setCountValue怎么用?PHP SMWQueryResult::setCountValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SMWQueryResult
的用法示例。
在下文中一共展示了SMWQueryResult::setCountValue方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: makeQueryResultForCount
private function makeQueryResultForCount(FederateResultSet $federateResultSet, Query $query)
{
$queryResult = new QueryResult($query->getDescription()->getPrintrequests(), $query, array(), $this->store, false);
if ($federateResultSet->getErrorCode() === FederateResultSet::ERROR_NOERROR) {
$queryResult->setCountValue($federateResultSet->getNumericValue());
} else {
$queryResult->addErrors(array(wfMessage('smw_db_sparqlqueryproblem')->inContentLanguage()->text()));
}
return $queryResult;
}
示例2: getCountQueryResult
/**
* Using a preprocessed internal query description referenced by $rootid, compute
* the proper counting output for the given query.
*
* @param Query $query
* @param integer $rootid
*
* @return integer
*/
private function getCountQueryResult(Query $query, $rootid)
{
$queryResult = new QueryResult($query->getDescription()->getPrintrequests(), $query, array(), $this->store, false);
$queryResult->setCountValue(0);
$qobj = $this->querySegmentList[$rootid];
if ($qobj->joinfield === '') {
// empty result, no query needed
return 0;
}
$db = $this->store->getConnection('mw.db');
$sql_options = array('LIMIT' => $query->getLimit() + 1, 'OFFSET' => $query->getOffset());
$res = $db->select($db->tableName($qobj->joinTable) . " AS {$qobj->alias}" . $qobj->from, "COUNT(DISTINCT {$qobj->alias}.smw_id) AS count", $qobj->where, __METHOD__, $sql_options);
$row = $db->fetchObject($res);
$count = $row->count;
$db->freeResult($res);
$queryResult->setCountValue($count);
return $queryResult;
}