From a0cd02b670426c7df5d4980cde060ef23bff6001 Mon Sep 17 00:00:00 2001 From: Sergei Tigrov Date: Sun, 5 May 2024 15:06:16 +0700 Subject: [PATCH 1/3] Update tests according to the main PR (#344) --- tests/CommandTest.php | 6 +++--- tests/Provider/CommandProvider.php | 16 ++++++++-------- tests/QueryBuilderTest.php | 4 ++-- tests/QueryTest.php | 2 +- 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/tests/CommandTest.php b/tests/CommandTest.php index 960d6aa73..5b59e25a8 100644 --- a/tests/CommandTest.php +++ b/tests/CommandTest.php @@ -56,13 +56,13 @@ public function testAddDefaultValue(): void */ public function testBatchInsert( string $table, - array $columns, iterable $values, + array $columns, string $expected, array $expectedParams = [], int $insertedRow = 1 ): void { - parent::testBatchInsert($table, $columns, $values, $expected, $expectedParams, $insertedRow); + parent::testBatchInsert($table, $values, $columns, $expected, $expectedParams, $insertedRow); } /** @@ -113,7 +113,7 @@ public function testBooleanValuesBatchInsert(): void $db = $this->getConnection(true); $command = $db->createCommand(); - $command->batchInsert('{{bool_values}}', ['bool_col'], [[true], [false]]); + $command->insertBatch('{{bool_values}}', [[true], [false]], ['bool_col']); $this->assertSame(2, $command->execute()); diff --git a/tests/Provider/CommandProvider.php b/tests/Provider/CommandProvider.php index 5fafd8df0..cced0d4f4 100644 --- a/tests/Provider/CommandProvider.php +++ b/tests/Provider/CommandProvider.php @@ -18,9 +18,8 @@ public static function batchInsert(): array { $batchInsert = parent::batchInsert(); - $batchInsert['batchInsert binds params from jsonExpression'] = [ + $batchInsert['binds params from jsonExpression'] = [ '{{%type}}', - ['json_col', 'int_col', 'float_col', 'char_col', 'bool_col'], [ [ new JsonExpression( @@ -32,6 +31,7 @@ public static function batchInsert(): array false, ], ], + ['json_col', 'int_col', 'float_col', 'char_col', 'bool_col'], 'expected' => << << [':qp0' => 1, ':qp1' => null, ':qp2' => 3, ':qp3' => 1, ':qp4' => 1.0, ':qp5' => '', ':qp6' => false], ]; - $batchInsert['batchInsert casts string to int according to the table schema'] = [ + $batchInsert['casts string to int according to the table schema'] = [ '{{%type}}', - ['int_col', 'float_col', 'char_col', 'bool_col'], [['3', '1.1', '', false]], + ['int_col', 'float_col', 'char_col', 'bool_col'], 'expected' => << [':qp0' => 3, ':qp1' => 1.1, ':qp2' => '', ':qp3' => false], ]; - $batchInsert['batchInsert binds params from jsonbExpression'] = [ + $batchInsert['binds params from jsonbExpression'] = [ '{{%type}}', - ['jsonb_col', 'int_col', 'float_col', 'char_col', 'bool_col'], [[new JsonExpression(['a' => true]), 1, 1.1, '', false]], + ['jsonb_col', 'int_col', 'float_col', 'char_col', 'bool_col'], 'expected' => <<getConnection(true); $command = $db->createCommand(); - $command->batchInsert('bool_values', ['bool_col'], [[true], [false]])->execute(); + $command->insertBatch('bool_values', [[true], [false]], ['bool_col'])->execute(); $this->assertSame(1, (new Query($db))->from('bool_values')->where('bool_col = TRUE')->count()); $this->assertSame(1, (new Query($db))->from('bool_values')->where('bool_col = FALSE')->count()); From e047dd455b2e90bc32f3b0d511a067df32eebba6 Mon Sep 17 00:00:00 2001 From: Sergei Tigrov Date: Sun, 5 May 2024 15:17:49 +0700 Subject: [PATCH 2/3] Disable BC [skip ci] --- .github/workflows/{bc.yml => bc.yml_} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .github/workflows/{bc.yml => bc.yml_} (100%) diff --git a/.github/workflows/bc.yml b/.github/workflows/bc.yml_ similarity index 100% rename from .github/workflows/bc.yml rename to .github/workflows/bc.yml_ From 19c98cd1b8ab3a8e4a3c474e07b1068a4bdfac1b Mon Sep 17 00:00:00 2001 From: Sergei Tigrov Date: Fri, 10 May 2024 17:51:02 +0700 Subject: [PATCH 3/3] Replace call of `SchemaInterface::getRawTableName()` to `QuoterInterface::getRawTableName()` (#348) --- CHANGELOG.md | 1 + src/Schema.php | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index dfa9f2dc3..ff2b27051 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ ## 2.0.0 under development - Enh #336: Implement `SqlParser` and `ExpressionBuilder` driver classes (@Tigrov) +- Chg #348: Replace call of `SchemaInterface::getRawTableName()` to `QuoterInterface::getRawTableName()` (@Tigrov) ## 1.3.0 March 21, 2024 diff --git a/src/Schema.php b/src/Schema.php index 115878d05..913eabcb3 100644 --- a/src/Schema.php +++ b/src/Schema.php @@ -1067,7 +1067,7 @@ private function createColumnSchema(string $name): ColumnSchema */ protected function getCacheKey(string $name): array { - return array_merge([self::class], $this->generateCacheKey(), [$this->getRawTableName($name)]); + return array_merge([self::class], $this->generateCacheKey(), [$this->db->getQuoter()->getRawTableName($name)]); } /**