mirror of
https://github.com/silverstripe/silverstripe-sqlite3
synced 2024-10-22 17:05:37 +02:00
Update SQLite3Query to use generators
This commit is contained in:
parent
dbc0fb7094
commit
139c2b0ba6
@ -43,14 +43,11 @@ class SQLite3Query extends Query
|
||||
}
|
||||
}
|
||||
|
||||
public function seek($row)
|
||||
public function getIterator()
|
||||
{
|
||||
$this->handle->reset();
|
||||
$i=0;
|
||||
while ($i <= $row && $result = @$this->handle->fetchArray(SQLITE3_ASSOC)) {
|
||||
$i++;
|
||||
while ($data = $this->handle->fetchArray(SQLITE3_ASSOC)) {
|
||||
yield $data;
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -66,13 +63,4 @@ class SQLite3Query extends Query
|
||||
$this->handle->reset();
|
||||
return $c;
|
||||
}
|
||||
|
||||
public function nextRecord()
|
||||
{
|
||||
if ($data = $this->handle->fetchArray(SQLITE3_ASSOC)) {
|
||||
return $data;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user