From 34c063d7477dd2f5538bc1634b0dd2cf0a98b13f Mon Sep 17 00:00:00 2001 From: Tigrov Date: Tue, 3 Dec 2024 15:05:04 +0700 Subject: [PATCH 1/3] Update according to changes in `db` --- src/Connection.php | 13 +++++-------- src/QueryBuilder.php | 19 +++++++++++-------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/Connection.php b/src/Connection.php index 79cca8b61..be8c297c1 100644 --- a/src/Connection.php +++ b/src/Connection.php @@ -51,14 +51,11 @@ public function createTransaction(): TransactionInterface public function getQueryBuilder(): QueryBuilderInterface { - if ($this->queryBuilder === null) { - $this->queryBuilder = new QueryBuilder( - $this->getQuoter(), - $this->getSchema(), - ); - } - - return $this->queryBuilder; + return $this->queryBuilder ??= new QueryBuilder( + $this->getQuoter(), + $this->getSchema(), + $this->getServerInfo(), + ); } public function getQuoter(): QuoterInterface diff --git a/src/QueryBuilder.php b/src/QueryBuilder.php index f52d0dfea..e5f96c468 100644 --- a/src/QueryBuilder.php +++ b/src/QueryBuilder.php @@ -4,6 +4,7 @@ namespace Yiisoft\Db\Mssql; +use Yiisoft\Db\Connection\ServerInfoInterface; use Yiisoft\Db\Constant\ColumnType; use Yiisoft\Db\Constant\PseudoType; use Yiisoft\Db\Mssql\Column\ColumnDefinitionBuilder; @@ -52,14 +53,16 @@ final class QueryBuilder extends AbstractQueryBuilder PseudoType::UUID_PK => 'UNIQUEIDENTIFIER PRIMARY KEY', ]; - public function __construct(QuoterInterface $quoter, SchemaInterface $schema) - { - $ddlBuilder = new DDLQueryBuilder($this, $quoter, $schema); - $dmlBuilder = new DMLQueryBuilder($this, $quoter, $schema); - $dqlBuilder = new DQLQueryBuilder($this, $quoter); - $columnDefinitionBuilder = new ColumnDefinitionBuilder($this); - - parent::__construct($quoter, $schema, $ddlBuilder, $dmlBuilder, $dqlBuilder, $columnDefinitionBuilder); + public function __construct(QuoterInterface $quoter, SchemaInterface $schema, ServerInfoInterface $serverInfo) { + parent::__construct( + $quoter, + $schema, + $serverInfo, + new DDLQueryBuilder($this, $quoter, $schema), + new DMLQueryBuilder($this, $quoter, $schema), + new DQLQueryBuilder($this, $quoter), + new ColumnDefinitionBuilder($this), + ); } /** @deprecated Use {@see buildColumnDefinition()}. Will be removed in version 2.0. */ From 2de644443ce21c092155205d2d3b24c6fc1f1f9c Mon Sep 17 00:00:00 2001 From: StyleCI Bot Date: Tue, 3 Dec 2024 08:05:18 +0000 Subject: [PATCH 2/3] Apply fixes from StyleCI --- src/QueryBuilder.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/QueryBuilder.php b/src/QueryBuilder.php index e5f96c468..2e174d553 100644 --- a/src/QueryBuilder.php +++ b/src/QueryBuilder.php @@ -53,7 +53,8 @@ final class QueryBuilder extends AbstractQueryBuilder PseudoType::UUID_PK => 'UNIQUEIDENTIFIER PRIMARY KEY', ]; - public function __construct(QuoterInterface $quoter, SchemaInterface $schema, ServerInfoInterface $serverInfo) { + public function __construct(QuoterInterface $quoter, SchemaInterface $schema, ServerInfoInterface $serverInfo) + { parent::__construct( $quoter, $schema, From a3e122c78ec71f668f4289989773bcc85356b300 Mon Sep 17 00:00:00 2001 From: Tigrov Date: Sun, 8 Dec 2024 14:05:01 +0700 Subject: [PATCH 3/3] Add line to CHANGELOG.md [skip ci] --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index ba1266690..b510d266e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,6 +20,7 @@ - Enh #327: Refactor `Schema::findColumns()` method (@Tigrov) - Enh #328: Refactor `Schema::normalizeDefaultValue()` method and move it to `ColumnFactory` class (@Tigrov) - Enh #331: Refactor according to changes #902 in `yiisoft/db` package (@Tigrov) +- Chg #333: Update `QueryBuilder` constructor (@Tigrov) ## 1.2.0 March 21, 2024