返回当前行数据
null Driver_Database_Driver_Mongo_Result::fetch_assoc( )
protected function fetch_assoc()
{
if ($this->_result instanceof ArrayIterator)
{
$data = $this->_result->current();
$this->_result->next();
return $data;
}
// 当有缓存数据
if (isset($this->_data[$this->_current_row]))
{
return $this->_data[$this->_current_row];
}
$data = $this->_result->getNext();
if (isset($data['_id']) && is_object($data['_id']) && $data['_id'] instanceof MongoId)
{
$data['_id'] = (string)$data['_id'];
}
if ( isset($this->_query['select_as']) )foreach ($this->_query['select_as'] as $key=>$value)
{
// 对查询出的数据做select as转换
if (isset($data[$key]))
{
$data[$value] = $data[$key];
unset($data[$key]);
}
}
if (count($this->_data[$this->_current_row])>1000)
{
// 释放内存
$this->_data[$this->_current_row] = array();
}
// 记录
$this->_data[$this->_current_row] = $data;
return $data;
}