Skip to content

Commit 004bd94

Browse files
authored
Add insertEx additional test + bugfix for oracle (#205)
* Add insertEx additional test + bugfix for oracle * Rename method insertEx * Rename method insertEx. Part 2
1 parent a8d3245 commit 004bd94

5 files changed

Lines changed: 15 additions & 7 deletions

File tree

src/CommandPDO.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@ final class CommandPDO extends AbstractCommandPDO
1818
/**
1919
* @inheritDoc
2020
*/
21-
public function insertEx(string $table, array $columns): bool|array
21+
public function insertWithReturningPks(string $table, array $columns): bool|array
2222
{
2323
$params = [];
24-
$sql = $this->queryBuilder()->insertEx($table, $columns, $params);
24+
$sql = $this->queryBuilder()->insertWithReturningPks($table, $columns, $params);
2525

2626
$this->setSql($sql)->bindValues($params);
2727
$this->prepare(false);

src/DMLQueryBuilder.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public function __construct(
3131
parent::__construct($queryBuilder, $quoter, $schema);
3232
}
3333

34-
public function insertEx(string $table, QueryInterface|array $columns, array &$params = []): string
34+
public function insertWithReturningPks(string $table, QueryInterface|array $columns, array &$params = []): string
3535
{
3636
$sql = $this->insert($table, $columns, $params);
3737

tests/Provider/QueryBuilderProvider.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ public function insert(): array
265265
return $insert;
266266
}
267267

268-
public function insertEx(): array
268+
public function insertWithReturningPks(): array
269269
{
270270
$db = $this->getConnection();
271271

tests/QueryBuilderTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -445,16 +445,16 @@ public function testInsert(
445445
}
446446
447447
/**
448-
* @dataProvider \Yiisoft\Db\Pgsql\Tests\Provider\QueryBuilderProvider::insertEx()
448+
* @dataProvider \Yiisoft\Db\Pgsql\Tests\Provider\QueryBuilderProvider::insertWithReturningPks()
449449
*/
450-
public function testInsertEx(
450+
public function testInsertWithReturningPks(
451451
string $table,
452452
array|QueryInterface $columns,
453453
array $params,
454454
string $expectedSQL,
455455
array $expectedParams
456456
): void {
457-
parent::testInsertEx($table, $columns, $params, $expectedSQL, $expectedParams);
457+
parent::testInsertWithReturningPks($table, $columns, $params, $expectedSQL, $expectedParams);
458458
}
459459
460460
/**

tests/Support/Fixture/pgsql.sql

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ DROP TABLE IF EXISTS "constraints" CASCADE;
1616
DROP TABLE IF EXISTS "bool_values" CASCADE;
1717
DROP TABLE IF EXISTS "animal" CASCADE;
1818
DROP TABLE IF EXISTS "default_pk" CASCADE;
19+
DROP TABLE IF EXISTS "notauto_pk" CASCADE;
1920
DROP TABLE IF EXISTS "document" CASCADE;
2021
DROP TABLE IF EXISTS "comment" CASCADE;
2122
DROP TABLE IF EXISTS "dossier";
@@ -182,6 +183,13 @@ CREATE TABLE "default_pk" (
182183
type varchar(255) not null
183184
);
184185

186+
CREATE TABLE "notauto_pk" (
187+
id_1 INTEGER,
188+
id_2 INTEGER,
189+
type VARCHAR(255) NOT NULL,
190+
PRIMARY KEY (id_1, id_2)
191+
);
192+
185193
CREATE TABLE "document" (
186194
id serial primary key,
187195
title varchar(255) not null,

0 commit comments

Comments
 (0)