mirror of
https://github.com/silverstripe/silverstripe-sqlite3
synced 2024-10-22 17:05:37 +02:00
MINOR: fix broken seek()
This commit is contained in:
parent
bb67ad3cd2
commit
0699cd7d65
@ -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];
|
||||
|
Loading…
Reference in New Issue
Block a user