Skip to content

Commit 5db3f20

Browse files
committed
feat(ClientV2): Add execute(String, Map<String,Object>)
1 parent 6f56c9f commit 5db3f20

File tree

1 file changed

+19
-0
lines changed
  • client-v2/src/main/java/com/clickhouse/client/api

1 file changed

+19
-0
lines changed

client-v2/src/main/java/com/clickhouse/client/api/Client.java

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1916,6 +1916,25 @@ public CompletableFuture<CommandResponse> execute(String sql, CommandSettings se
19161916
});
19171917
}
19181918

1919+
/**
1920+
* <p>Executes a SQL command and doesn't care response. Useful for DDL statements, like `CREATE`, `DROP`, `ALTER`.
1921+
* Method however returns execution errors from a server or summary in case of successful execution. </p>
1922+
*
1923+
* @param sql - SQL command
1924+
* @param params - query parameters
1925+
* @return {@code CompletableFuture<CommandResponse>} - a promise to command response
1926+
*/
1927+
public CompletableFuture<CommandResponse> execute(String sql, Map<String, Object> params){
1928+
return query(sql, params)
1929+
.thenApplyAsync(response -> {
1930+
try {
1931+
return new CommandResponse(response);
1932+
} catch (Exception e) {
1933+
throw new ClientException("Failed to get command response", e);
1934+
}
1935+
});
1936+
}
1937+
19191938
/**
19201939
* <p>Executes a SQL command and doesn't care response. Useful for DDL statements, like `CREATE`, `DROP`, `ALTER`.
19211940
* Method however returns execution errors from a server or summary in case of successful execution. </p>

0 commit comments

Comments
 (0)