From a2678536818c351bf972a28aa3e96d278ab356f5 Mon Sep 17 00:00:00 2001 From: Aaron Piotrowski Date: Thu, 31 Aug 2023 21:56:55 -0500 Subject: [PATCH] Dispose of current result when next result is requested --- src/Internal/MysqlConnectionResult.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/Internal/MysqlConnectionResult.php b/src/Internal/MysqlConnectionResult.php index 7ca4b7c..1de1a63 100644 --- a/src/Internal/MysqlConnectionResult.php +++ b/src/Internal/MysqlConnectionResult.php @@ -72,9 +72,7 @@ public function fetchRow(): ?array public function getNextResult(): ?MysqlResult { - if ($this->generator->valid()) { - throw new \Error('Consume entire current result before requesting next result'); - } + self::dispose($this->generator); $this->nextResult ??= async(function (): ?MysqlResult { $deferred = $this->result->next ??= new DeferredFuture;