Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into refactor_dml_query_…
Browse files Browse the repository at this point in the history
…builder
  • Loading branch information
Tigrov committed Sep 6, 2023
2 parents ae66957 + fb4c084 commit c0ced2f
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 28 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.2 under development

- Bug #746: Refactor `DMLQueryBuilder` and fix: unique indexes in `upsert()`, column names with table name and brackets, `batchInsert()` with associative arrays, enhanced documentation of `batchInsert()` and `update()` (@Tigrov)
- Bug #751: Fix collected debug actions (@xepozz)

## 1.1.1 August 16, 2023

Expand Down
2 changes: 1 addition & 1 deletion docs/en/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ For [PostgreSQL](https://github.com/yiisoft/db-pgsql):
composer require yiisoft/db-pgsql
```

For [SQLite](https://github.com/yiisoft/db-pgsql):
For [SQLite](https://github.com/yiisoft/db-sqlite):

```bash
composer require yiisoft/db-sqlite
Expand Down
16 changes: 10 additions & 6 deletions src/Debug/DatabaseCollector.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,10 @@ public function collectQueryStart(
'line' => $line,
'status' => self::QUERY_STATUS_INITIALIZED,
'actions' => [
'action' => self::ACTION_QUERY_START,
'time' => microtime(true),
[
'action' => self::ACTION_QUERY_START,
'time' => microtime(true),
],
],
];
}
Expand Down Expand Up @@ -127,8 +129,10 @@ public function collectTransactionStart(
'line' => $line,
'level' => $isolationLevel,
'actions' => [
'action' => self::ACTION_TRANSACTION_START,
'time' => microtime(true),
[
'action' => self::ACTION_TRANSACTION_START,
'time' => microtime(true),
],
],
];
}
Expand All @@ -140,7 +144,7 @@ public function collectTransactionRollback(
string $line,
): void {
$this->transactions[$this->currentTransactionId]['status'] = self::TRANSACTION_STATUS_ROLLBACK;
$this->transactions[$this->currentTransactionId]['actions'] = [
$this->transactions[$this->currentTransactionId]['actions'][] = [
'action' => self::ACTION_TRANSACTION_ROLLBACK,
'line' => $line,
'time' => microtime(true),
Expand All @@ -155,7 +159,7 @@ public function collectTransactionCommit(
string $line,
): void {
$this->transactions[$this->currentTransactionId]['status'] = self::TRANSACTION_STATUS_COMMIT;
$this->transactions[$this->currentTransactionId]['actions'] = [
$this->transactions[$this->currentTransactionId]['actions'][] = [
'action' => self::ACTION_TRANSACTION_COMMIT,
'line' => $line,
'time' => microtime(true),
Expand Down
43 changes: 22 additions & 21 deletions tests/Provider/ColumnTypes.php
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ public function getColumnTypes(): array
'mysql' => 'datetime(0) NOT NULL',
'pgsql' => 'timestamp(0) NOT NULL',
'sqlite' => 'datetime NOT NULL',
'oci' => 'TIMESTAMP NOT NULL',
'oci' => 'TIMESTAMP(0) NOT NULL',
'sqlsrv' => 'datetime NOT NULL',
],
],
Expand All @@ -208,7 +208,7 @@ public function getColumnTypes(): array
'mysql' => 'datetime(0)',
'pgsql' => 'timestamp(0)',
'sqlite' => 'datetime',
'oci' => 'TIMESTAMP',
'oci' => 'TIMESTAMP(0)',
'sqlsrv' => 'datetime',
],
],
Expand All @@ -218,7 +218,7 @@ public function getColumnTypes(): array
'mysql' => 'decimal(10,0) CHECK (value > 5.6)',
'pgsql' => 'numeric(10,0) CHECK (value > 5.6)',
'sqlite' => 'decimal(10,0) CHECK (value > 5.6)',
'oci' => 'NUMBER CHECK (value > 5.6)',
'oci' => 'NUMBER(10,0) CHECK (value > 5.6)',
'sqlsrv' => 'decimal(18,0) CHECK (value > 5.6)',
],
],
Expand All @@ -228,7 +228,7 @@ public function getColumnTypes(): array
'mysql' => 'decimal(10,0) NOT NULL',
'pgsql' => 'numeric(10,0) NOT NULL',
'sqlite' => 'decimal(10,0) NOT NULL',
'oci' => 'NUMBER NOT NULL',
'oci' => 'NUMBER(10,0) NOT NULL',
'sqlsrv' => 'decimal(18,0) NOT NULL',
],
],
Expand All @@ -238,7 +238,7 @@ public function getColumnTypes(): array
'mysql' => 'decimal(12,4) CHECK (value > 5.6)',
'pgsql' => 'numeric(12,4) CHECK (value > 5.6)',
'sqlite' => 'decimal(12,4) CHECK (value > 5.6)',
'oci' => 'NUMBER CHECK (value > 5.6)',
'oci' => 'NUMBER(12,4) CHECK (value > 5.6)',
'sqlsrv' => 'decimal(12,4) CHECK (value > 5.6)',
],
],
Expand All @@ -248,7 +248,7 @@ public function getColumnTypes(): array
'mysql' => 'decimal(12,4)',
'pgsql' => 'numeric(12,4)',
'sqlite' => 'decimal(12,4)',
'oci' => 'NUMBER',
'oci' => 'NUMBER(12,4)',
'sqlsrv' => 'decimal(12,4)',
],
],
Expand All @@ -258,7 +258,7 @@ public function getColumnTypes(): array
'mysql' => 'decimal(10,0)',
'pgsql' => 'numeric(10,0)',
'sqlite' => 'decimal(10,0)',
'oci' => 'NUMBER',
'oci' => 'NUMBER(10,0)',
'sqlsrv' => 'decimal(18,0)',
],
],
Expand All @@ -268,7 +268,7 @@ public function getColumnTypes(): array
'mysql' => 'double CHECK (value > 5.6)',
'pgsql' => 'double precision CHECK (value > 5.6)',
'sqlite' => 'double CHECK (value > 5.6)',
'oci' => 'NUMBER CHECK (value > 5.6)',
'oci' => 'BINARY_DOUBLE CHECK (value > 5.6)',
'sqlsrv' => 'float CHECK (value > 5.6)',
],
],
Expand All @@ -278,7 +278,7 @@ public function getColumnTypes(): array
'mysql' => 'double NOT NULL',
'pgsql' => 'double precision NOT NULL',
'sqlite' => 'double NOT NULL',
'oci' => 'NUMBER NOT NULL',
'oci' => 'BINARY_DOUBLE NOT NULL',
'sqlsrv' => 'float NOT NULL',
],
],
Expand All @@ -288,7 +288,7 @@ public function getColumnTypes(): array
'mysql' => 'double CHECK (value > 5.6)',
'pgsql' => 'double precision CHECK (value > 5.6)',
'sqlite' => 'double CHECK (value > 5.6)',
'oci' => 'NUMBER CHECK (value > 5.6)',
'oci' => 'BINARY_DOUBLE CHECK (value > 5.6)',
'sqlsrv' => 'float CHECK (value > 5.6)',
],
],
Expand All @@ -297,7 +297,7 @@ public function getColumnTypes(): array
[
'mysql' => 'double',
'sqlite' => 'double',
'oci' => 'NUMBER',
'oci' => 'BINARY_DOUBLE',
'sqlsrv' => 'float',
],
],
Expand All @@ -307,7 +307,7 @@ public function getColumnTypes(): array
'mysql' => 'double',
'pgsql' => 'double precision',
'sqlite' => 'double',
'oci' => 'NUMBER',
'oci' => 'BINARY_DOUBLE',
'sqlsrv' => 'float',
],
],
Expand All @@ -317,7 +317,7 @@ public function getColumnTypes(): array
'mysql' => 'float CHECK (value > 5.6)',
'pgsql' => 'double precision CHECK (value > 5.6)',
'sqlite' => 'float CHECK (value > 5.6)',
'oci' => 'NUMBER CHECK (value > 5.6)',
'oci' => 'BINARY_FLOAT CHECK (value > 5.6)',
'sqlsrv' => 'float CHECK (value > 5.6)',
],
],
Expand All @@ -327,7 +327,7 @@ public function getColumnTypes(): array
'mysql' => 'float NOT NULL',
'pgsql' => 'double precision NOT NULL',
'sqlite' => 'float NOT NULL',
'oci' => 'NUMBER NOT NULL',
'oci' => 'BINARY_FLOAT NOT NULL',
'sqlsrv' => 'float NOT NULL',
],
],
Expand All @@ -337,7 +337,7 @@ public function getColumnTypes(): array
'mysql' => 'float CHECK (value > 5.6)',
'pgsql' => 'double precision CHECK (value > 5.6)',
'sqlite' => 'float CHECK (value > 5.6)',
'oci' => 'NUMBER CHECK (value > 5.6)',
'oci' => 'BINARY_FLOAT CHECK (value > 5.6)',
'sqlsrv' => 'float CHECK (value > 5.6)',
],
],
Expand All @@ -346,7 +346,7 @@ public function getColumnTypes(): array
[
'mysql' => 'float',
'sqlite' => 'float',
'oci' => 'NUMBER',
'oci' => 'BINARY_FLOAT',
'sqlsrv' => 'float',
],
],
Expand All @@ -356,7 +356,7 @@ public function getColumnTypes(): array
'mysql' => 'float',
'pgsql' => 'double precision',
'sqlite' => 'float',
'oci' => 'NUMBER',
'oci' => 'BINARY_FLOAT',
'sqlsrv' => 'float',
],
],
Expand Down Expand Up @@ -648,7 +648,7 @@ public function getColumnTypes(): array
'mysql' => 'time(0) NOT NULL',
'pgsql' => 'time(0) NOT NULL',
'sqlite' => 'time NOT NULL',
'oci' => 'TIMESTAMP NOT NULL',
'oci' => 'INTERVAL DAY(0) TO SECOND(0) NOT NULL',
'sqlsrv' => 'time NOT NULL',
],
],
Expand All @@ -658,7 +658,7 @@ public function getColumnTypes(): array
'mysql' => 'time(0)',
'pgsql' => 'time(0)',
'sqlite' => 'time',
'oci' => 'TIMESTAMP',
'oci' => 'INTERVAL DAY(0) TO SECOND(0)',
'sqlsrv' => 'time',
],
],
Expand All @@ -668,7 +668,7 @@ public function getColumnTypes(): array
'mysql' => 'timestamp(0) NOT NULL',
'pgsql' => 'timestamp(0) NOT NULL',
'sqlite' => 'timestamp NOT NULL',
'oci' => 'TIMESTAMP NOT NULL',
'oci' => 'TIMESTAMP(0) NOT NULL',
'sqlsrv' => 'datetime NOT NULL',
],
],
Expand All @@ -685,6 +685,7 @@ public function getColumnTypes(): array
SchemaInterface::TYPE_TIMESTAMP . '(4)',
[
'pgsql' => 'timestamp(4)',
'oci' => 'TIMESTAMP(4)',
],
],
'$this->timestamp()' => [
Expand All @@ -697,7 +698,7 @@ public function getColumnTypes(): array
*/
'pgsql' => 'timestamp(0)',
'sqlite' => 'timestamp',
'oci' => 'TIMESTAMP',
'oci' => 'TIMESTAMP(0)',
'sqlsrv' => 'datetime',
],
],
Expand Down

0 comments on commit c0ced2f

Please sign in to comment.