Pheasant\Database\Mysqli\ResultIterator::seek PHP 메소드

seek() 공개 메소드

Seeks to a particular position in the result, offset is from 0.
public seek ( $position )
    public function seek($position)
    {
        if ($position < 0) {
            throw new \OutOfBoundsException("Unable to seek to negative offset {$position}");
        }
        if ($this->_position !== $position) {
            if (($count = $this->_result->num_rows) && $position > $count - 1) {
                throw new \OutOfBoundsException("Unable to seek to offset {$position}");
            }
            if ($count) {
                $this->_result->data_seek($this->_position = $position);
                $this->_currentRow = $this->_fetch();
            }
            $this->_position = $position;
        }
    }