Skip to content

Commit

Permalink
Merge branch 'master' into ease-local-testing
Browse files Browse the repository at this point in the history
  • Loading branch information
arogachev committed Dec 10, 2024
2 parents ab5125f + 1e6b86e commit 94138dd
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 15 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
13 changes: 5 additions & 8 deletions src/Connection.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
18 changes: 11 additions & 7 deletions src/QueryBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -52,14 +53,17 @@ final class QueryBuilder extends AbstractQueryBuilder
PseudoType::UUID_PK => 'UNIQUEIDENTIFIER PRIMARY KEY',
];

public function __construct(QuoterInterface $quoter, SchemaInterface $schema)
public function __construct(QuoterInterface $quoter, SchemaInterface $schema, ServerInfoInterface $serverInfo)
{
$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);
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. */
Expand Down

0 comments on commit 94138dd

Please sign in to comment.