选择语言 :

 Driver_Database_Driver_Mongo_Result::seek

null Driver_Database_Driver_Mongo_Result::seek( )
File: ./drivers/database/mongo/result.class.php
public function seek($offset)
{
    if ($this->_result instanceof ArrayIterator)
    {
        if ($this->offsetExists($offset) && $this->_result->seet($offset))
        {
            return true;
        }
        else
        {
            return false;
        }
    }

    if ($this->offsetExists($offset))
    {
        if ($this->_internal_row < $this->_current_row)
        {
            $c = $this->_internal_row - $this->_current_row;
            for( $i=0;$i<$c;$i++ )
            {
                $this->_result->next();
            }
        }
        else
        {
            // 小于当前指针,则回退重新来过,因为目前 MongoCursor 还没有回退的功能
            $this->_result->rewind();
            $c = $this->_current_row - $this->_internal_row;
            for($i=0; $i<$c; $i++)
            {
                $this->_result->next();
            }
        }

        $this->_current_row = $this->_internal_row = $offset;

        return true;
    }
    else
    {
        return false;
    }
}