Skip to content

Commit ba83399

Browse files
committed
Support --secure and --query_id two options
1 parent 7db110f commit ba83399

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

clickhouse-cli-client/src/main/java/com/clickhouse/client/cli/ClickHouseCommandLine.java

+12-7
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,9 @@ static Process startProcess(ClickHouseNode server, ClickHouseRequest<?> request)
158158
containerDir = hostDir;
159159
}
160160

161+
if (config.isSsl()) {
162+
commands.add("--secure");
163+
}
161164
commands.add("--compression=".concat(config.isResponseCompressed() ? "1" : "0"));
162165
commands.add("--host=".concat(server.getHost()));
163166
commands.add("--port=".concat(Integer.toString(server.getPort())));
@@ -166,11 +169,10 @@ static Process startProcess(ClickHouseNode server, ClickHouseRequest<?> request)
166169
if (!ClickHouseChecker.isNullOrBlank(str)) {
167170
commands.add("--database=".concat(str));
168171
}
169-
if ((boolean) config.getOption(ClickHouseCommandLineOption.USE_CLI_CONFIG)) {
170-
str = (String) config.getOption(ClickHouseCommandLineOption.CLI_CONFIG_FILE);
171-
if (Files.exists(Paths.get(str))) {
172-
commands.add("--config-file=".concat(str));
173-
}
172+
str = (String) config.getOption(ClickHouseCommandLineOption.CLI_CONFIG_FILE);
173+
if ((boolean) config.getOption(ClickHouseCommandLineOption.USE_CLI_CONFIG)
174+
&& !ClickHouseChecker.isNullOrBlank(str) && Files.exists(Paths.get(str))) {
175+
commands.add("--config-file=".concat(str));
174176
} else {
175177
ClickHouseCredentials credentials = server.getCredentials(config);
176178
str = credentials.getUserName();
@@ -184,8 +186,11 @@ static Process startProcess(ClickHouseNode server, ClickHouseRequest<?> request)
184186
}
185187
commands.add("--format=".concat(config.getFormat().name()));
186188

187-
str = request.getStatements(false).get(0);
188-
commands.add("--query=".concat(str));
189+
str = request.getQueryId().orElse("");
190+
if (!ClickHouseChecker.isNullOrBlank(str)) {
191+
commands.add("--query_id=".concat(str));
192+
}
193+
commands.add("--query=".concat(request.getStatements(false).get(0)));
189194

190195
for (ClickHouseExternalTable table : request.getExternalTables()) {
191196
ClickHouseFile tableFile = table.getFile();

0 commit comments

Comments
 (0)