database = $database; $this->handle = $handle; } public function __destruct() { if ($this->handle) { $this->handle->finalize(); } } public function seek($row) { $this->handle->reset(); $i=0; while ($i <= $row && $result = @$this->handle->fetchArray(SQLITE3_ASSOC)) { $i++; } return $result; } /** * @todo This looks terrible but there is no SQLite3::get_num_rows() implementation */ public function numRecords() { // Some queries are not iterable using fetchArray like CREATE statement if (!$this->handle->numColumns()) { return 0; } $this->handle->reset(); $c=0; while ($this->handle->fetchArray()) { $c++; } $this->handle->reset(); return $c; } public function nextRecord() { if ($data = $this->handle->fetchArray(SQLITE3_ASSOC)) { return $data; } else { return false; } } }