/** * Seek to a specific record of the result set * * @param int $row The index of the row to position to (zero-based) * * @return void */ public function seek($row) { switch ($this->mode) { case "mysql": $this->result->data_seek($row); break; case "postgres": case "redshift": pg_result_seek($this->result, $row); break; case "odbc": # The odbc driver doesn't support seeking, so we fetch specific rows in getNextRow(), and here all we need to do is set the current position instance variable break; case "sqlite": $this->result->reset(); for ($i = 0; $i < $row; $i++) { $this->result->fetchArray(); } break; case "mssql": mssql_data_seek($this->result, $row); break; } $this->position = $row; }
/** * set the result pointer to offset * * @param int $pos * @return boolean */ public function seek($pos) { if (!$this->result) { return false; } if ($pos >= $this->numRows()) { $pos = 0; } if ($this->result->data_seek($pos)) { $this->pos = $pos; return true; } else { return false; } }
/** * @param resource|ResultWrapper $res * @param int $row * @return mixed */ protected function mysqlDataSeek($res, $row) { return $res->data_seek($row); }
public function seek($row) { if (is_object($this->handle)) { return $this->handle->data_seek($row); } }
/** * Rewind the result set * * @param resource $res * @return boolean */ public function rewind($res) { if ($res and $res->num_rows > 0) { return $res->data_seek(0); } return true; }