From 48d220101ad58947bb7be7aa4066ac2fda24e079 Mon Sep 17 00:00:00 2001 From: Guy Sartorelli Date: Thu, 15 Sep 2022 16:24:08 +1200 Subject: [PATCH] FIX Reset query generator after iteration is complete --- code/PostgreSQLQuery.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/code/PostgreSQLQuery.php b/code/PostgreSQLQuery.php index 67a6faa..17a4d14 100644 --- a/code/PostgreSQLQuery.php +++ b/code/PostgreSQLQuery.php @@ -62,6 +62,8 @@ class PostgreSQLQuery extends Query while ($row = pg_fetch_array($this->handle, null, PGSQL_NUM)) { yield $this->parseResult($row); } + // Reset so the query can be iterated over again + pg_result_seek($this->handle, 0); } public function numRecords()