本文整理汇总了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;
}
示例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);
}
}
示例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
}
}
示例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;
}
示例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;
}