Skip to content

Commit

Permalink
Refactor DMLQueryBuilder (#746)
Browse files Browse the repository at this point in the history
* Refactor DMLQueryBuilder

* Get uniques using `getTableIndexes()` and `getTableUniques()`

* Fix @psalm-var

* Fix #61 (point 2)

* Fix #61 (point 2) add test

* Improve test

* Remove methods with `NotSupportedException`

* Fix test issues

* Fix test issues

* Revert "Remove methods with `NotSupportedException`"

* Add line to CHANGELOG.md

* Change order of checks

* Improve performance of quoting column names up to 10% using `array_map()`

* Update CHANGELOG.md

* remove `Generator` in `DMLQueryBuilderInterface`

* Update psalm

* Apply suggestions from code review

Co-authored-by: Sergei Predvoditelev <[email protected]>

* Apply StyleCI

* Remove `Generator` from other places

* Return and deprecate `getTypecastValue()` method and `$table` parameter

* Fix psalm

* Fix psalm

* Update CHANGELOG.md

---------

Co-authored-by: Sergei Predvoditelev <[email protected]>
  • Loading branch information
Tigrov and vjik authored Nov 1, 2023
1 parent 4f1dbb9 commit 39872b1
Show file tree
Hide file tree
Showing 10 changed files with 163 additions and 164 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

## 1.1.2 under development

- Enh #746: Refactor `AbstractDMLQueryBuilder` (@Tigrov)
- Bug #746: Fix `AbstractDMLQueryBuilder::upsert()` when unique index is not at the first position of inserted values (@Tigrov)
- Bug #746: Typecast values in `AbstractDMLQueryBuilder::batchInsert()` if column names with table name and brackets (@Tigrov)
- Bug #746, #61: Typecast values in `AbstractDMLQueryBuilder::batchInsert()` if values with string keys (@Tigrov)
- Enh #746: Enhanced documentation of `batchInsert()` and `update()` methods of `DMLQueryBuilderInterface` interface (@Tigrov)
- Bug #751: Fix collected debug actions (@xepozz)
- Chg #755: Deprecate `TableSchemaInterface::compositeForeignKey()` (@Tigrov)
- Enh #756: Refactor `Quoter` (@Tigrov)
Expand Down
3 changes: 3 additions & 0 deletions psalm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,7 @@
<directory name="vendor" />
</ignoreFiles>
</projectFiles>
<issueHandlers>
<MixedAssignment errorLevel="suppress" />
</issueHandlers>
</psalm>
4 changes: 4 additions & 0 deletions src/Command/CommandInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,8 @@ public function alterColumn(string $table, string $column, ColumnInterface|strin
* @throws Exception
* @throws InvalidArgumentException
*
* @psalm-param iterable<array-key, array<array-key, mixed>> $rows
*
* Note: The method will quote the `table` and `column` parameters before using them in the generated SQL.
*/
public function batchInsert(string $table, array $columns, iterable $rows): static;
Expand Down Expand Up @@ -820,6 +822,8 @@ public function update(string $table, array $columns, array|string $condition =
* @throws JsonException
* @throws NotSupportedException
*
* @psalm-param array<string, mixed>|QueryInterface $insertColumns
*
* Note: The method will quote the `table` and `insertColumns`, `updateColumns` parameters before using it in the
* generated SQL.
*/
Expand Down
Loading

0 comments on commit 39872b1

Please sign in to comment.