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


PHP resource::command方法代碼示例

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


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

示例1: query

 /**
  * query method
  *  If call getMongoDb() from model, this method call getMongoDb().
  *
  * @param mixed $query
  * @param array $params array()
  * @return void
  * @access public
  */
 public function query()
 {
     $args = func_get_args();
     $query = $args[0];
     $params = array();
     if (count($args) > 1) {
         $params = $args[1];
     }
     if (!$this->isConnected()) {
         return false;
     }
     if ($query === 'getMongoDb') {
         return $this->getMongoDb();
     }
     if (count($args) > 1 && (strpos($args[0], 'findBy') === 0 || strpos($args[0], 'findAllBy') === 0)) {
         $params = $args[1];
         if (substr($args[0], 0, 6) === 'findBy') {
             $field = Inflector::underscore(substr($args[0], 6));
             return $args[2]->find('first', array('conditions' => array($field => $args[1][0])));
         } else {
             $field = Inflector::underscore(substr($args[0], 9));
             return $args[2]->find('all', array('conditions' => array($field => $args[1][0])));
         }
     }
     if (isset($args[2]) && is_a($args[2], 'Model')) {
         $this->_prepareLogQuery($args[2]);
     }
     $return = $this->_db->command($query);
     if ($this->fullDebug) {
         $this->logQuery("db.runCommand( :query )", compact('query'));
     }
     return $return;
 }
開發者ID:abhilashlohar,項目名稱:Housingmatters,代碼行數:42,代碼來源:MongodbSource.php

示例2: command

 /**
  * Command.
  * 
  * Runs a MongoDB command (such as GeoNear). See the MongoDB documentation for more usage scenarios - http://dochub.mongodb.org/core/commands
  *
  * <code>
  * $this->mongo_db->command(array('geoNear'=>'buildings', 'near'=>array(53.228482, -0.547847), 'num' => 10, 'nearSphere'=>true));
  * </code>
  *
  * @param array $query The command query
  *
  * @access public
  * @return object
  */
 public function command($query = array())
 {
     try {
         $execute = $this->_dbhandle->command($query);
         return $execute;
     } catch (MongoCursorException $exception) {
         $this->_show_error('MongoDB command failed to execute: ' . $exception->getMessage(), 500);
     }
 }
開發者ID:NaszvadiG,項目名稱:cim-xa,代碼行數:23,代碼來源:Mongo_db.php

示例3: command

 /**
  * Command.
  *
  * Runs a MongoDB command (such as GeoNear). See the MongoDB documentation
  *  for more usage scenarios - http://dochub.mongodb.org/core/commands
  *
  * @param array $query The command query
  *
  * @access public
  * @return object
  */
 public function command($query = array())
 {
     try {
         $execute = $this->_dbhandle->command($query);
         return $execute;
     } catch (MongoCursorException $Exception) {
         throw new \MongoQB\Exception('MongoDB command failed to execute: ' . $Exception->getMessage());
         // @codeCoverageIgnoreEnd
     }
 }
開發者ID:noopable,項目名稱:MongoQB,代碼行數:21,代碼來源:Builder.php

示例4: query

 /**
  * query method
  *
  * @param mixed $query
  * @param array $params array()
  * @return void
  * @access public
  */
 public function query($query, $params = array())
 {
     $this->_prepareLogQuery($Model);
     // just sets a timer
     $result = $this->_db->command($query);
     if ($this->fullDebug) {
         $this->logQuery("db.runCommand( :query )", compact('query'));
     }
     if ($result['ok']) {
         return $result['values'];
     }
     return $result;
 }
開發者ID:r0mk1n,項目名稱:cakephp-mongodb,代碼行數:21,代碼來源:mongodb_source.php

示例5: query

 /**
  * query method
  *  If call getMongoDb() from model, this method call getMongoDb().
  *
  * @param mixed $query
  * @param array $params array()
  * @return void
  * @access public
  */
 public function query($query, $params = array())
 {
     if (!$this->isConnected()) {
         return false;
     }
     if ($query === 'getMongoDb') {
         return $this->getMongoDb();
     }
     $this->_prepareLogQuery($Model);
     // just sets a timer
     $return = $this->_db->command($query);
     if ($this->fullDebug) {
         $this->logQuery("db.runCommand( :query )", compact('query'));
     }
     return $return;
 }
開發者ID:ThemisB,項目名稱:mongoDB-Datasource,代碼行數:25,代碼來源:mongodb_source.php


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