mirror of
https://github.com/silverstripe/silverstripe-postgresql
synced 2024-10-22 17:05:45 +02:00
Update PostgreSQLQuery to use generators
This commit is contained in:
parent
577988715f
commit
25e57f4598
@ -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);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user