Merge pull request #44 from kinglozzer/generators

Update SQLite3Query to use generators
This commit is contained in:
Daniel Hensby 2018-03-19 11:23:24 +00:00 committed by GitHub
commit 9c4de41c7a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -43,14 +43,11 @@ class SQLite3Query extends Query
} }
} }
public function seek($row) public function getIterator()
{ {
$this->handle->reset(); while ($data = $this->handle->fetchArray(SQLITE3_ASSOC)) {
$i=0; yield $data;
while ($i <= $row && $result = @$this->handle->fetchArray(SQLITE3_ASSOC)) {
$i++;
} }
return $result;
} }
/** /**
@ -66,13 +63,4 @@ class SQLite3Query extends Query
$this->handle->reset(); $this->handle->reset();
return $c; return $c;
} }
public function nextRecord()
{
if ($data = $this->handle->fetchArray(SQLITE3_ASSOC)) {
return $data;
} else {
return false;
}
}
} }