mirror of
https://github.com/silverstripe/silverstripe-postgresql
synced 2024-10-22 17:05:45 +02:00
Merge pull request #84 from kinglozzer/generators
Update PostgreSQLQuery to use generators
This commit is contained in:
commit
bb5bda6643
@ -34,19 +34,15 @@ class PostgreSQLQuery extends Query
|
||||
}
|
||||
}
|
||||
|
||||
public function seek($row)
|
||||
public function getIterator()
|
||||
{
|
||||
pg_result_seek($this->handle, $row);
|
||||
return pg_fetch_assoc($this->handle);
|
||||
while ($data = pg_fetch_assoc($this->handle)) {
|
||||
yield $data;
|
||||
}
|
||||
}
|
||||
|
||||
public function numRecords()
|
||||
{
|
||||
return pg_num_rows($this->handle);
|
||||
}
|
||||
|
||||
public function nextRecord()
|
||||
{
|
||||
return pg_fetch_assoc($this->handle);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user