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) {
|
public function seek($row) {
|
||||||
$this->handle->reset();
|
$this->handle->reset();
|
||||||
$i=0;
|
$i=0;
|
||||||
while($i < $row && $row = SQLite3Result::fetchArray()) $i++;
|
while($i < $row && $row = @$this->handle->fetchArray()) $i++;
|
||||||
return (bool) $row;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1232,14 +1232,14 @@ class SQLite3Query extends SS_Query {
|
|||||||
*/
|
*/
|
||||||
public function numRecords() {
|
public function numRecords() {
|
||||||
$c=0;
|
$c=0;
|
||||||
while($this->handle->fetchArray()) $c++;
|
while(@$this->handle->fetchArray()) $c++;
|
||||||
$this->handle->reset();
|
$this->handle->reset();
|
||||||
return $c;
|
return $c;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function nextRecord() {
|
public function nextRecord() {
|
||||||
// Coalesce rather than replace common fields.
|
// 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) {
|
foreach($data as $columnIdx => $value) {
|
||||||
if(preg_match('/^"([a-z0-9_]+)"\."([a-z0-9_]+)"$/i', $this->handle->columnName($columnIdx), $matches)) $columnName = $matches[2];
|
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];
|
else if(preg_match('/^"([a-z0-9_]+)"$/i', $this->handle->columnName($columnIdx), $matches)) $columnName = $matches[1];
|
||||||
|
Loading…
Reference in New Issue
Block a user