Update PostgreSQLQuery to use generators

This commit is contained in:
Loz Calver 2018-03-16 16:43:07 +00:00
parent 577988715f
commit 25e57f4598

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