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


PHP DboSource::logQuery方法代碼示例

本文整理匯總了PHP中DboSource::logQuery方法的典型用法代碼示例。如果您正苦於以下問題:PHP DboSource::logQuery方法的具體用法?PHP DboSource::logQuery怎麽用?PHP DboSource::logQuery使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在DboSource的用法示例。


在下文中一共展示了DboSource::logQuery方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: logQuery

    /**
     * logQuery method
     *
     * Set timers, errors and refer to the parent
     * If there are arguments passed - inject them into the query
     * Show MongoIds in a copy-and-paste-into-mongo format
     *
     *
     * @param mixed $query
     * @param array $args array()
     * @return void
     * @access public
     */
    public function logQuery($query, $args = array()) {
        if ($args) {
            $this->_stringify($args);
            $query = String::insert($query, $args);
        }
        $this->took = round((microtime(true) - $this->_startTime) * 1000, 0);
        $this->affected = null;
        if (empty($this->error['err'])) {
            $this->error = $this->_db->lastError();
            if (!is_scalar($this->error)) {
                $this->error = json_encode($this->error);
            }
        }
        $this->numRows = !empty($args['count']) ? $args['count'] : null;

        $query = preg_replace('@"ObjectId\((.*?)\)"@', 'ObjectId ("\1")', $query);
        return parent::logQuery($query);
    }
開發者ID:nishant-shrivastava,項目名稱:test-mongo-db,代碼行數:31,代碼來源:mongodb_source.php

示例2: logQuery

 /**
  * logQuery method
  *
  * Set timers, errors and refer to the parent
  * If there are arguments passed - inject them into the query
  * Show MongoIds in a copy-and-paste-into-mongo format
  *
  *
  * @param mixed $query
  * @param array $args array()
  * @return void
  * @access public
  */
 public function logQuery($query, $args = array())
 {
     if ($args) {
         $this->_stringify($args);
         $query = CakeText::insert($query, $args);
     }
     $this->took = round((microtime(true) - $this->_startTime) * 1000, 0);
     $this->affected = null;
     $this->numRows = !empty($args['count']) ? $args['count'] : null;
     $query = preg_replace('@"ObjectId\\((.*?)\\)"@', 'ObjectId ("\\1")', $query);
     return parent::logQuery($query);
 }
開發者ID:pdedkov,項目名稱:cakephp-mongo,代碼行數:25,代碼來源:MongoDbSource.php


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