From a288de99fde3e01f7306c91e825aab5feba600c6 Mon Sep 17 00:00:00 2001 From: Tigrov Date: Wed, 17 Apr 2024 10:34:30 +0700 Subject: [PATCH 1/2] Fix BatchQueryResult according to main PR --- src/BatchQueryResult.php | 47 ---------------------------------- src/Connection.php | 5 ---- tests/BatchQueryResultTest.php | 35 ------------------------- 3 files changed, 87 deletions(-) delete mode 100644 src/BatchQueryResult.php delete mode 100644 tests/BatchQueryResultTest.php diff --git a/src/BatchQueryResult.php b/src/BatchQueryResult.php deleted file mode 100644 index 91dce5d7d..000000000 --- a/src/BatchQueryResult.php +++ /dev/null @@ -1,47 +0,0 @@ -dataReader?->next(); - /** @psalm-var array|bool $row */ - $row = $this->dataReader?->current(); - } while ($row && ($rows[] = $row) && ++$count < $this->batchSize); - } catch (PDOException $e) { - if (!in_array($this->mssqlNoMoreRowsErrorCode, (array) $e->errorInfo, true)) { - throw $e; - } - } - - return $rows; - } -} diff --git a/src/Connection.php b/src/Connection.php index 79cca8b61..d68a92023 100644 --- a/src/Connection.php +++ b/src/Connection.php @@ -20,11 +20,6 @@ */ final class Connection extends AbstractPdoConnection { - public function createBatchQueryResult(QueryInterface $query, bool $each = false): BatchQueryResultInterface - { - return new BatchQueryResult($query, $each); - } - public function createCommand(string $sql = null, array $params = []): PdoCommandInterface { $command = new Command($this); diff --git a/tests/BatchQueryResultTest.php b/tests/BatchQueryResultTest.php deleted file mode 100644 index 678061157..000000000 --- a/tests/BatchQueryResultTest.php +++ /dev/null @@ -1,35 +0,0 @@ -getConnection(true); - - $query = new Query($db); - $query->from('customer')->orderBy('id')->limit(3)->indexBy('id'); - - $batchQueryResult = new BatchQueryResult($query); - - $customers = $this->getAllRowsFromBatch($batchQueryResult); - - $this->assertCount(3, $customers); - $this->assertEquals('user1', $customers[0]['name']); - $this->assertEquals('user2', $customers[1]['name']); - $this->assertEquals('user3', $customers[2]['name']); - } -} From b7cc679eb6f0bee347eeb43d37d4b5d37611d2ab Mon Sep 17 00:00:00 2001 From: StyleCI Bot Date: Wed, 17 Apr 2024 03:34:49 +0000 Subject: [PATCH 2/2] Apply fixes from StyleCI --- src/Connection.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/Connection.php b/src/Connection.php index d68a92023..a8bd34324 100644 --- a/src/Connection.php +++ b/src/Connection.php @@ -6,8 +6,6 @@ use Yiisoft\Db\Driver\Pdo\AbstractPdoConnection; use Yiisoft\Db\Driver\Pdo\PdoCommandInterface; -use Yiisoft\Db\Query\BatchQueryResultInterface; -use Yiisoft\Db\Query\QueryInterface; use Yiisoft\Db\QueryBuilder\QueryBuilderInterface; use Yiisoft\Db\Schema\QuoterInterface; use Yiisoft\Db\Schema\SchemaInterface;