当前位置: 首页>>代码示例>>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;未经允许,请勿转载。