當前位置: 首頁>>代碼示例>>PHP>>正文


PHP CDBResult::navQuery方法代碼示例

本文整理匯總了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;
 }
開發者ID:k-kalashnikov,項目名稱:geekcon_new,代碼行數:60,代碼來源:query.php


注:本文中的CDBResult::navQuery方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。