Skip to content

Commit 26404f6

Browse files
committed
fixed ccat executable path
1 parent b978289 commit 26404f6

File tree

1 file changed

+25
-2
lines changed

1 file changed

+25
-2
lines changed

src/Transport/ClickhouseCLIClientTransport.php

+25-2
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,13 @@ class ClickhouseCLIClientTransport implements TransportInterface
2828
*/
2929
protected $catExecutablePath;
3030

31+
/**
32+
* Path to executable ccat command
33+
*
34+
* @var string
35+
*/
36+
protected $ccatExecutablePath;
37+
3138
/**
3239
* Last execute query
3340
*
@@ -47,12 +54,14 @@ class ClickhouseCLIClientTransport implements TransportInterface
4754
*
4855
* @param string|null $executablePath
4956
* @param string|null $catExecutablePath
57+
* @param string|null $ccatExecutablePath
5058
* @param bool $useCcat
5159
*/
52-
public function __construct(string $executablePath = null, string $catExecutablePath = null, bool $useCcat = false)
60+
public function __construct(string $executablePath = null, string $catExecutablePath = null, string $ccatExecutablePath = null, bool $useCcat = false)
5361
{
5462
$this->setExecutablePath($executablePath);
5563
$this->setCatExecutablePath($catExecutablePath);
64+
$this->setCcatExecutablePath($ccatExecutablePath);
5665
$this->useCcat = $useCcat;
5766
}
5867

@@ -84,6 +93,20 @@ protected function setCatExecutablePath(string $catExecutablePath = null)
8493
$this->catExecutablePath = $catExecutablePath;
8594
}
8695

96+
/**
97+
* Set path to ccat executable.
98+
*
99+
* @param string|null $ccatExecutablePath
100+
*/
101+
protected function setCcatExecutablePath(string $ccatExecutablePath = null)
102+
{
103+
if (is_null($ccatExecutablePath)) {
104+
$ccatExecutablePath = 'ccat';
105+
}
106+
107+
$this->ccatExecutablePath = $ccatExecutablePath;
108+
}
109+
87110
/**
88111
* Sends query to given $server.
89112
*
@@ -322,7 +345,7 @@ protected function buildCommandForWriteFilesAsOne(Server $server, string $query,
322345
$command = [];
323346

324347
if ($this->useCcat) {
325-
$command[] = $this->catExecutablePath.' '.$file.' | ';
348+
$command[] = $this->ccatExecutablePath.' '.$file.' | ';
326349
} else {
327350
$command[] = '$('.$this->catExecutablePath.' '.$file.') | ';
328351
}

0 commit comments

Comments
 (0)