本文整理汇总了PHP中MongoCursor::info方法的典型用法代码示例。如果您正苦于以下问题:PHP MongoCursor::info方法的具体用法?PHP MongoCursor::info怎么用?PHP MongoCursor::info使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MongoCursor
的用法示例。
在下文中一共展示了MongoCursor::info方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: isIterating
/**
* Is the query iterating yet?
*
* @link http://www.php.net/manual/en/mongocursor.info.php \MongoCursor::info
*
* @since 0.3.0
* @since 1.0.0 is_iterating → isIterating
*
* @return boolean
*/
public function isIterating()
{
if (!$this->cursor) {
return false;
}
$info = $this->cursor->info();
return $info['started_iterating'];
}
示例2: key
/**
* Wrapper method for MongoCursor::key().
*
* @see http://php.net/manual/en/iterator.key.php
* @see http://php.net/manual/en/mongocursor.key.php
* @return mixed
*/
public function key()
{
// TODO: Track position internally to avoid repeated info() calls
if (!$this->useIdentifierKeys) {
$info = $this->mongoCursor->info();
return isset($info['at']) ? $info['at'] : null;
}
return $this->mongoCursor->key();
}
示例3: is_iterating
/**
* Is the query iterating yet?
*
* @throws Exception
* @return bool
*/
public function is_iterating()
{
if (!$this->_cursor) {
return FALSE;
}
$info = $this->_cursor->info();
if (!isset($info['started_iterating'])) {
throw new Exception('Driver version >= 1.0.10 required.');
}
return $info['started_iterating'];
}
示例4: fetchRows
/**
* Fetches rows from the given Mongo cursor.
* @param \MongoCursor $cursor Mongo cursor instance to fetch data from.
* @param boolean $all whether to fetch all rows or only first one.
* @param string|callable $indexBy the column name or PHP callback,
* by which the query results should be indexed by.
* @throws Exception on failure.
* @return array|boolean result.
*/
protected function fetchRows($cursor, $all = true, $indexBy = null)
{
$token = 'find(' . Json::encode($cursor->info()) . ')';
Yii::info($token, __METHOD__);
try {
Yii::beginProfile($token, __METHOD__);
$result = $this->fetchRowsInternal($cursor, $all, $indexBy);
Yii::endProfile($token, __METHOD__);
return $result;
} catch (\Exception $e) {
Yii::endProfile($token, __METHOD__);
throw new Exception($e->getMessage(), (int) $e->getCode(), $e);
}
}
示例5: fetchRows
/**
* Fetches rows from the given Mongo cursor.
*
* @param \MongoCursor $cursor Mongo cursor instance to fetch data from.
* @param boolean $all whether to fetch all rows or only first one.
* @param string|callable $indexBy the column name or PHP callback,
* by which the query results should be indexed by.
* @throws MongoException on failure.
* @return array|null result.
*/
protected function fetchRows($cursor, $all = true, $indexBy = null)
{
$rawQuery = 'find(' . Json::encode($cursor->info()) . ')';
//Log::info($token, __METHOD__);
$token = ['query' => $rawQuery, 'valid' => true, 'cache' => false];
Trace::beginProfile('mongodb.query', $token);
$cache = $cacheKey = null;
$lock = true;
if (($result = $this->getCache($rawQuery, $token, $all, $indexBy, $cache, $cacheKey, $lock)) !== false) {
return $result;
}
if ($lock === false) {
return null;
}
try {
$result = $this->fetchRowsInternal($cursor, $all);
$this->setCache($result, $cache, $cacheKey);
Trace::endProfile('mongodb.query', $token);
Trace::trace('mongodb.query', $token);
return $result;
} catch (\Exception $e) {
$message = $e->getMessage() . "\nThe query being executed was: {$rawQuery}";
Trace::endProfile('mongodb.query', $token);
$token['valid'] = false;
$token['exception'] = defined('ROCK_DEBUG') && ROCK_DEBUG === true ? $e : $message;
Trace::trace('mongodb.query', $token);
if (isset($cache, $cacheKey) && $cache instanceof CacheInterface) {
$cache->unlock($cacheKey);
}
throw new MongoException($message, [], 0, $e);
}
}
示例6: info
/**
* Wrapper method for MongoCursor::info().
*
* @see http://php.net/manual/en/mongocursor.info.php
* @return array
*/
public function info()
{
return $this->mongoCursor->info();
}
示例7: info
/**
* Gets the query, fields, limit, and skip for this cursor
* @link http://www.php.net/manual/en/mongocursor.info.php
* @return array The query, fields, limit, and skip for this cursor as an associative array.
*/
public function info()
{
return $this->cursor->info();
}
示例8: info
/**
*
* @return array
*/
public function info()
{
$info = $this->cursor->info();
return $info;
}