Skip to content

Commit

Permalink
Merge branch 'master' of github.com:yiisoft/db-mysql into logger
Browse files Browse the repository at this point in the history
  • Loading branch information
darkdef committed Jan 2, 2024
2 parents 8f985b5 + 65497c3 commit 8648007
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
## 1.1.1 under development

- Enh #312: Change property `Schema::$typeMap` to constant `Schema::TYPE_MAP` (@Tigrov)
- Bug #314: Fix `Command::insertWithReturningPks()` method for empty values (@Tigrov)

## 1.1.0 November 12, 2023

Expand Down
3 changes: 2 additions & 1 deletion src/Command.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,12 @@ public function insertWithReturningPks(string $table, array $columns): bool|arra
$sql = $this->db->getQueryBuilder()->insert($table, $columns, $params);
$this->setSql($sql)->bindValues($params);

$tableSchema = $this->db->getSchema()->getTableSchema($table);

if (!$this->execute()) {
return false;
}

$tableSchema = $this->db->getSchema()->getTableSchema($table);
$tablePrimaryKeys = $tableSchema?->getPrimaryKey() ?? [];
$result = [];

Expand Down
11 changes: 8 additions & 3 deletions tests/QueryBuilderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -142,9 +142,14 @@ public function testAddUnique(string $name, string $table, array|string $columns
* @throws InvalidArgumentException
* @throws NotSupportedException
*/
public function testBatchInsert(string $table, array $columns, iterable $rows, string $expected): void
{
parent::testBatchInsert($table, $columns, $rows, $expected);
public function testBatchInsert(
string $table,
array $columns,
iterable $rows,
string $expected,
array $expectedParams = [],
): void {
parent::testBatchInsert($table, $columns, $rows, $expected, $expectedParams);
}

/**
Expand Down

0 comments on commit 8648007

Please sign in to comment.