diff --git a/CHANGELOG.md b/CHANGELOG.md index cf3960422..78750d667 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/docs/en/README.md b/docs/en/README.md index 7002fa3c0..bc93b7e05 100644 --- a/docs/en/README.md +++ b/docs/en/README.md @@ -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 diff --git a/src/Debug/DatabaseCollector.php b/src/Debug/DatabaseCollector.php index ff708dbb4..2bf444c92 100644 --- a/src/Debug/DatabaseCollector.php +++ b/src/Debug/DatabaseCollector.php @@ -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), + ], ], ]; } @@ -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), + ], ], ]; } @@ -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), @@ -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), diff --git a/tests/Provider/ColumnTypes.php b/tests/Provider/ColumnTypes.php index 8312298df..2cd4bffc1 100644 --- a/tests/Provider/ColumnTypes.php +++ b/tests/Provider/ColumnTypes.php @@ -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', ], ], @@ -208,7 +208,7 @@ public function getColumnTypes(): array 'mysql' => 'datetime(0)', 'pgsql' => 'timestamp(0)', 'sqlite' => 'datetime', - 'oci' => 'TIMESTAMP', + 'oci' => 'TIMESTAMP(0)', 'sqlsrv' => 'datetime', ], ], @@ -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)', ], ], @@ -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', ], ], @@ -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)', ], ], @@ -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)', ], ], @@ -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)', ], ], @@ -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)', ], ], @@ -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', ], ], @@ -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)', ], ], @@ -297,7 +297,7 @@ public function getColumnTypes(): array [ 'mysql' => 'double', 'sqlite' => 'double', - 'oci' => 'NUMBER', + 'oci' => 'BINARY_DOUBLE', 'sqlsrv' => 'float', ], ], @@ -307,7 +307,7 @@ public function getColumnTypes(): array 'mysql' => 'double', 'pgsql' => 'double precision', 'sqlite' => 'double', - 'oci' => 'NUMBER', + 'oci' => 'BINARY_DOUBLE', 'sqlsrv' => 'float', ], ], @@ -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)', ], ], @@ -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', ], ], @@ -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)', ], ], @@ -346,7 +346,7 @@ public function getColumnTypes(): array [ 'mysql' => 'float', 'sqlite' => 'float', - 'oci' => 'NUMBER', + 'oci' => 'BINARY_FLOAT', 'sqlsrv' => 'float', ], ], @@ -356,7 +356,7 @@ public function getColumnTypes(): array 'mysql' => 'float', 'pgsql' => 'double precision', 'sqlite' => 'float', - 'oci' => 'NUMBER', + 'oci' => 'BINARY_FLOAT', 'sqlsrv' => 'float', ], ], @@ -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', ], ], @@ -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', ], ], @@ -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', ], ], @@ -685,6 +685,7 @@ public function getColumnTypes(): array SchemaInterface::TYPE_TIMESTAMP . '(4)', [ 'pgsql' => 'timestamp(4)', + 'oci' => 'TIMESTAMP(4)', ], ], '$this->timestamp()' => [ @@ -697,7 +698,7 @@ public function getColumnTypes(): array */ 'pgsql' => 'timestamp(0)', 'sqlite' => 'timestamp', - 'oci' => 'TIMESTAMP', + 'oci' => 'TIMESTAMP(0)', 'sqlsrv' => 'datetime', ], ],