Update SQLite3Query to use generators

This commit is contained in:
Loz Calver 2018-03-16 16:47:48 +00:00 committed by Daniel Hensby
parent dbc0fb7094
commit 139c2b0ba6
No known key found for this signature in database
GPG Key ID: B00D1E9767F0B06E

View File

@ -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;
}
}
}