Skip to content

Commit 9786e69

Browse files
authored
Prepare values in hash condition (#423)
1 parent 5a3fed7 commit 9786e69

File tree

3 files changed

+12
-13
lines changed

3 files changed

+12
-13
lines changed

tests/ArrayExpressionBuilderTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -104,14 +104,14 @@ public static function buildProvider(): array
104104
'Query w/o type' => [
105105
(new Query(self::getDb()))->select('id')->from('users')->where(['active' => 1]),
106106
null,
107-
'ARRAY(SELECT "id" FROM "users" WHERE "active"=:qp0)',
108-
[':qp0' => 1],
107+
'ARRAY(SELECT "id" FROM "users" WHERE "active"=1)',
108+
[],
109109
],
110110
'Query' => [
111111
[(new Query(self::getDb()))->select('id')->from('users')->where(['active' => 1])],
112112
'integer[][]',
113-
'ARRAY[ARRAY(SELECT "id" FROM "users" WHERE "active"=:qp0)::integer[]]::integer[][]',
114-
[':qp0' => 1],
113+
'ARRAY[ARRAY(SELECT "id" FROM "users" WHERE "active"=1)::integer[]]::integer[][]',
114+
[],
115115
],
116116
'bool' => [
117117
[[[true], [false, null]], [['t', 'f'], null], null],

tests/Provider/QueryBuilderProvider.php

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -195,14 +195,13 @@ public static function insertReturningPks(): array
195195
),
196196
[':phBar' => 'bar'],
197197
<<<SQL
198-
INSERT INTO "customer" ("email", "name", "address", "is_active", "related_id") SELECT "email", "name", "address", "is_active", "related_id" FROM "customer" WHERE ("email"=:qp1) AND ("name"=:qp2) AND ("address"=:qp3) AND ("is_active"=:qp4) AND ("related_id" IS NULL) AND ("col"=CONCAT(:phFoo, :phBar)) RETURNING "id"
198+
INSERT INTO "customer" ("email", "name", "address", "is_active", "related_id") SELECT "email", "name", "address", "is_active", "related_id" FROM "customer" WHERE ("email"=:qp1) AND ("name"=:qp2) AND ("address"=:qp3) AND ("is_active"=FALSE) AND ("related_id" IS NULL) AND ("col"=CONCAT(:phFoo, :phBar)) RETURNING "id"
199199
SQL,
200200
[
201201
':phBar' => 'bar',
202-
':qp1' => '[email protected]',
203-
':qp2' => 'sergeymakinen',
204-
':qp3' => '{{city}}',
205-
':qp4' => false,
202+
':qp1' => new Param('[email protected]', DataType::STRING),
203+
':qp2' => new Param('sergeymakinen', DataType::STRING),
204+
':qp3' => new Param('{{city}}', DataType::STRING),
206205
':phFoo' => 'foo',
207206
],
208207
],

tests/StructuredExpressionBuilderTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -79,14 +79,14 @@ public static function buildProvider(): array
7979
'Query w/o type' => [
8080
(new Query(self::getDb()))->select('price')->from('product')->where(['id' => 1]),
8181
null,
82-
'(SELECT "price" FROM "product" WHERE "id"=:qp0)',
83-
[':qp0' => 1],
82+
'(SELECT "price" FROM "product" WHERE "id"=1)',
83+
[],
8484
],
8585
'Query' => [
8686
(new Query(self::getDb()))->select('price')->from('product')->where(['id' => 1]),
8787
'currency_money',
88-
'(SELECT "price" FROM "product" WHERE "id"=:qp0)::currency_money',
89-
[':qp0' => 1],
88+
'(SELECT "price" FROM "product" WHERE "id"=1)::currency_money',
89+
[],
9090
],
9191
'ordered array' => [
9292
['value' => '5', 'currency_code' => 'USD'],

0 commit comments

Comments
 (0)