Merge pull request #111 from dhensby/pulls/3/seek-before-iterate

FIX Allow repeat calls to `getIterator()`
This commit is contained in:
Robbie Averill 2020-03-29 14:54:58 -07:00 committed by GitHub
commit e18651cd33
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 0 deletions

View File

@ -58,6 +58,7 @@ class PostgreSQLQuery extends Query
public function getIterator() public function getIterator()
{ {
pg_result_seek($this->handle, 0);
while ($data = $this->nextRecord()) { while ($data = $this->nextRecord()) {
yield $data; yield $data;
} }

View File

@ -15,6 +15,7 @@
} }
], ],
"require": { "require": {
"ext-pgsql": "*",
"silverstripe/framework": "^5", "silverstripe/framework": "^5",
"silverstripe/vendor-plugin": "^1.0" "silverstripe/vendor-plugin": "^1.0"
}, },