本文整理汇总了PHP中CDBResult::navQuery方法的典型用法代码示例。如果您正苦于以下问题:PHP CDBResult::navQuery方法的具体用法?PHP CDBResult::navQuery怎么用?PHP CDBResult::navQuery使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CDBResult
的用法示例。
在下文中一共展示了CDBResult::navQuery方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: query
protected function query($build_parts)
{
// nosql support with new platform only
if (file_exists($_SERVER["DOCUMENT_ROOT"] . "/bitrix/d7.php")) {
// check nosql configuration
$configuration = $this->init_entity->getConnection()->getConfiguration();
if (isset($configuration['handlersocket']['read'])) {
$nosqlConnectionName = $configuration['handlersocket']['read'];
$nosqlConnection = \Bitrix\Main\Application::getInstance()->getDbConnectionPool()->getConnection($nosqlConnectionName);
$isNosqlCapable = NosqlPrimarySelector::checkQuery($nosqlConnection, $this);
if ($isNosqlCapable) {
$nosqlResult = NosqlPrimarySelector::relayQuery($nosqlConnection, $this);
$result = new \CDBResult();
$result->initFromArray($nosqlResult);
return $result;
}
}
}
foreach ($build_parts as $k => &$v) {
if (strlen($v)) {
$v = $k . ' ' . $v;
}
}
if (!empty($this->options)) {
foreach ($this->options as $opt => $value) {
$build_parts = str_replace('%' . $opt . '%', $value, $build_parts);
}
}
$query = join("\n", $build_parts);
list($query, $replaced_aliases) = $this->replaceSelectAliases($query);
if ($this->count_total || !is_null($this->offset)) {
$cnt_body_elements = $build_parts;
// remove order
unset($cnt_body_elements['ORDER BY']);
$cnt_query = join("\n", $cnt_body_elements);
// remove long aliases
list($cnt_query, ) = $this->replaceSelectAliases($cnt_query);
// select count
$cnt_query = 'SELECT COUNT(1) AS TMP_ROWS_CNT FROM (' . $cnt_query . ') xxx';
$result = $this->DB->query($cnt_query);
$result = $result->fetch();
$cnt = $result["TMP_ROWS_CNT"];
}
if (empty($this->limit)) {
$result = $this->DB->query($query);
$result->arReplacedAliases = $replaced_aliases;
} elseif (!empty($this->limit) && is_null($this->offset)) {
$query = $this->DB->topSql($query, intval($this->limit));
$result = $this->DB->query($query);
$result->arReplacedAliases = $replaced_aliases;
} else {
// main query
$result = new \CDBResult();
$result->arReplacedAliases = $replaced_aliases;
$db_limit = array('nPageSize' => $this->limit, 'iNumPage' => $this->offset ? $this->offset / $this->limit + 1 : 1, 'bShowAll' => true);
$result->navQuery($query, $cnt, $db_limit);
}
$this->last_query = $query;
return $result;
}