Skip to content

Commit 2bec2d0

Browse files
author
Yevhen Chornohradskyi
committed
[FIX] Pass settings as a 2nd Client argument
1 parent e573327 commit 2bec2d0

File tree

2 files changed

+17
-12
lines changed

2 files changed

+17
-12
lines changed

composer.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"name": "friendsofdoctrine/dbal-clickhouse",
2+
"name": "dreamteam-gg/dbal-clickhouse",
33
"type": "library",
44
"description": "Doctrine DBAL driver for ClickHouse",
55
"keywords": [

src/ClickHouseConnection.php

+16-11
Original file line numberDiff line numberDiff line change
@@ -46,15 +46,19 @@ public function __construct(
4646
string $password,
4747
AbstractPlatform $platform
4848
) {
49-
$this->smi2CHClient = new Smi2CHClient([
50-
'host' => $params['host'] ?? 'localhost',
51-
'port' => $params['port'] ?? 8123,
52-
'username' => $username,
53-
'password' => $password,
54-
'settings' => array_merge([
55-
'database' => $params['dbname'] ?? 'default',
56-
], $params['driverOptions'] ?? []),
57-
]);
49+
$this->smi2CHClient = new Smi2CHClient(
50+
[
51+
'host' => $params['host'] ?? 'localhost',
52+
'port' => $params['port'] ?? 8123,
53+
'username' => $username,
54+
'password' => $password,
55+
],
56+
[
57+
'settings' => array_merge([
58+
'database' => $params['dbname'] ?? 'default',
59+
], $params['driverOptions'] ?? []),
60+
]
61+
);
5862

5963
$this->platform = $platform;
6064
}
@@ -94,7 +98,7 @@ public function quote($input, $type = ParameterType::STRING)
9498
/**
9599
* {@inheritDoc}
96100
*/
97-
public function exec($statement) : int
101+
public function exec($statement): int
98102
{
99103
$stmt = $this->prepare($statement);
100104
$stmt->execute();
@@ -165,7 +169,8 @@ public function getServerVersion()
165169
{
166170
try {
167171
return $this->smi2CHClient->getServerVersion();
168-
} catch (TransportException $exception) {
172+
}
173+
catch (TransportException $exception) {
169174
return '';
170175
}
171176
}

0 commit comments

Comments
 (0)