Skip to content

Commit a7d9d13

Browse files
authored
Update according to changes in db (#294)
1 parent 4e9fa61 commit a7d9d13

File tree

4 files changed

+18
-13
lines changed

4 files changed

+18
-13
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
- Enh #288: Refactor `Schema::findColumns()` method (@Tigrov)
2323
- Enh #289: Refactor `Schema::normalizeDefaultValue()` method and move it to `ColumnFactory` class (@Tigrov)
2424
- New #292: Override `QueryBuilder::prepareBinary()` method (@Tigrov)
25+
- Chg #294: Update `QueryBuilder` constructor (@Tigrov)
2526

2627
## 1.3.0 March 21, 2024
2728

src/Connection.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -73,11 +73,11 @@ public function getLastInsertID(string $sequenceName = null): string
7373

7474
public function getQueryBuilder(): QueryBuilderInterface
7575
{
76-
if ($this->queryBuilder === null) {
77-
$this->queryBuilder = new QueryBuilder($this->getQuoter(), $this->getSchema());
78-
}
79-
80-
return $this->queryBuilder;
76+
return $this->queryBuilder ??= new QueryBuilder(
77+
$this->getQuoter(),
78+
$this->getSchema(),
79+
$this->getServerInfo(),
80+
);
8181
}
8282

8383
public function getQuoter(): QuoterInterface

src/QueryBuilder.php

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
namespace Yiisoft\Db\Oracle;
66

7+
use Yiisoft\Db\Connection\ServerInfoInterface;
78
use Yiisoft\Db\Constant\ColumnType;
89
use Yiisoft\Db\Constant\PseudoType;
910
use Yiisoft\Db\Oracle\Column\ColumnDefinitionBuilder;
@@ -47,14 +48,17 @@ final class QueryBuilder extends AbstractQueryBuilder
4748
PseudoType::UUID_PK => 'RAW(16) DEFAULT SYS_GUID() PRIMARY KEY',
4849
];
4950

50-
public function __construct(QuoterInterface $quoter, SchemaInterface $schema)
51+
public function __construct(QuoterInterface $quoter, SchemaInterface $schema, ServerInfoInterface $serverInfo)
5152
{
52-
$ddlBuilder = new DDLQueryBuilder($this, $quoter, $schema);
53-
$dmlBuilder = new DMLQueryBuilder($this, $quoter, $schema);
54-
$dqlBuilder = new DQLQueryBuilder($this, $quoter);
55-
$columnDefinitionBuilder = new ColumnDefinitionBuilder($this);
56-
57-
parent::__construct($quoter, $schema, $ddlBuilder, $dmlBuilder, $dqlBuilder, $columnDefinitionBuilder);
53+
parent::__construct(
54+
$quoter,
55+
$schema,
56+
$serverInfo,
57+
new DDLQueryBuilder($this, $quoter, $schema),
58+
new DMLQueryBuilder($this, $quoter, $schema),
59+
new DQLQueryBuilder($this, $quoter),
60+
new ColumnDefinitionBuilder($this),
61+
);
5862
}
5963

6064
protected function prepareBinary(string $binary): string

tests/SchemaTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ public function testGetSchemaNames(): void
9292

9393
$schema = $db->getSchema();
9494

95-
if (version_compare($db->getServerVersion(), '12', '>')) {
95+
if (version_compare($db->getServerInfo()->getVersion(), '12', '>')) {
9696
$this->assertContains('SYSBACKUP', $schema->getSchemaNames());
9797
} else {
9898
$this->assertEmpty($schema->getSchemaNames());

0 commit comments

Comments
 (0)