mirror of
https://github.com/silverstripe/silverstripe-sqlite3
synced 2024-10-22 17:05:37 +02:00
Merge pull request #44 from kinglozzer/generators
Update SQLite3Query to use generators
This commit is contained in:
commit
9c4de41c7a
@ -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