Skip to content

Commit d9f0f8d

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

File tree

1 file changed

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

1 file changed

+20
-0
lines changed

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

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1935,6 +1935,26 @@ public CompletableFuture<CommandResponse> execute(String sql, Map<String, Object
19351935
});
19361936
}
19371937

1938+
/**
1939+
* <p>Executes a SQL command and doesn't care response. Useful for DDL statements, like `CREATE`, `DROP`, `ALTER`.
1940+
* Method however returns execution errors from a server or summary in case of successful execution. </p>
1941+
*
1942+
* @param sql - SQL command
1943+
* @param params - query parameters
1944+
* @param settings - execution settings
1945+
* @return {@code CompletableFuture<CommandResponse>} - a promise to command response
1946+
*/
1947+
public CompletableFuture<CommandResponse> execute(String sql, Map<String, Object> params, CommandSettings settings){
1948+
return query(sql, params, settings)
1949+
.thenApplyAsync(response -> {
1950+
try {
1951+
return new CommandResponse(response);
1952+
} catch (Exception e) {
1953+
throw new ClientException("Failed to get command response", e);
1954+
}
1955+
});
1956+
}
1957+
19381958
/**
19391959
* <p>Executes a SQL command and doesn't care response. Useful for DDL statements, like `CREATE`, `DROP`, `ALTER`.
19401960
* Method however returns execution errors from a server or summary in case of successful execution. </p>

0 commit comments

Comments
 (0)