Merge pull request #84 from kinglozzer/generators

Update PostgreSQLQuery to use generators
This commit is contained in:
Daniel Hensby 2018-03-17 14:48:16 +00:00 committed by GitHub
commit bb5bda6643
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -34,19 +34,15 @@ class PostgreSQLQuery extends Query
} }
} }
public function seek($row) public function getIterator()
{ {
pg_result_seek($this->handle, $row); while ($data = pg_fetch_assoc($this->handle)) {
return pg_fetch_assoc($this->handle); yield $data;
}
} }
public function numRecords() public function numRecords()
{ {
return pg_num_rows($this->handle); return pg_num_rows($this->handle);
} }
public function nextRecord()
{
return pg_fetch_assoc($this->handle);
}
} }