From 0699cd7d65744e02b7c494edb6180e1c396c793e Mon Sep 17 00:00:00 2001 From: Andreas Piening Date: Thu, 15 Apr 2010 05:45:08 +0000 Subject: [PATCH] MINOR: fix broken seek() --- code/SQLite3Database.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/code/SQLite3Database.php b/code/SQLite3Database.php index 126465c..af59923 100644 --- a/code/SQLite3Database.php +++ b/code/SQLite3Database.php @@ -1223,8 +1223,8 @@ class SQLite3Query extends SS_Query { public function seek($row) { $this->handle->reset(); $i=0; - while($i < $row && $row = SQLite3Result::fetchArray()) $i++; - return (bool) $row; + while($i < $row && $row = @$this->handle->fetchArray()) $i++; + return true; } /** @@ -1232,14 +1232,14 @@ class SQLite3Query extends SS_Query { */ public function numRecords() { $c=0; - while($this->handle->fetchArray()) $c++; + while(@$this->handle->fetchArray()) $c++; $this->handle->reset(); return $c; } public function nextRecord() { // Coalesce rather than replace common fields. - if(@$data = $this->handle->fetchArray(SQLITE3_NUM)) { + if($data = @$this->handle->fetchArray(SQLITE3_NUM)) { foreach($data as $columnIdx => $value) { if(preg_match('/^"([a-z0-9_]+)"\."([a-z0-9_]+)"$/i', $this->handle->columnName($columnIdx), $matches)) $columnName = $matches[2]; else if(preg_match('/^"([a-z0-9_]+)"$/i', $this->handle->columnName($columnIdx), $matches)) $columnName = $matches[1];