@@ -28,6 +28,13 @@ class ClickhouseCLIClientTransport implements TransportInterface
28
28
*/
29
29
protected $ catExecutablePath ;
30
30
31
+ /**
32
+ * Path to executable ccat command
33
+ *
34
+ * @var string
35
+ */
36
+ protected $ ccatExecutablePath ;
37
+
31
38
/**
32
39
* Last execute query
33
40
*
@@ -47,12 +54,14 @@ class ClickhouseCLIClientTransport implements TransportInterface
47
54
*
48
55
* @param string|null $executablePath
49
56
* @param string|null $catExecutablePath
57
+ * @param string|null $ccatExecutablePath
50
58
* @param bool $useCcat
51
59
*/
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 )
53
61
{
54
62
$ this ->setExecutablePath ($ executablePath );
55
63
$ this ->setCatExecutablePath ($ catExecutablePath );
64
+ $ this ->setCcatExecutablePath ($ ccatExecutablePath );
56
65
$ this ->useCcat = $ useCcat ;
57
66
}
58
67
@@ -84,6 +93,20 @@ protected function setCatExecutablePath(string $catExecutablePath = null)
84
93
$ this ->catExecutablePath = $ catExecutablePath ;
85
94
}
86
95
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
+
87
110
/**
88
111
* Sends query to given $server.
89
112
*
@@ -322,7 +345,7 @@ protected function buildCommandForWriteFilesAsOne(Server $server, string $query,
322
345
$ command = [];
323
346
324
347
if ($ this ->useCcat ) {
325
- $ command [] = $ this ->catExecutablePath .' ' .$ file .' | ' ;
348
+ $ command [] = $ this ->ccatExecutablePath .' ' .$ file .' | ' ;
326
349
} else {
327
350
$ command [] = '$( ' .$ this ->catExecutablePath .' ' .$ file .') | ' ;
328
351
}
0 commit comments