ygerzhedovich commented on code in PR #1866:
URL: https://github.com/apache/ignite-3/pull/1866#discussion_r1154311991


##########
modules/client-handler/src/main/java/org/apache/ignite/client/handler/JdbcQueryEventHandlerImpl.java:
##########
@@ -228,16 +227,25 @@ public CompletableFuture<JdbcBatchExecuteResult> 
batchPrepStatementAsync(
         });
     }
 
-    private CompletableFuture<Long> executeAndCollectUpdateCount(String 
schema, String sql, Object[] arg) {
+    private CompletableFuture<Long> executeAndCollectUpdateCount(long 
connectionId, String sql, Object[] arg) {
         var context = 
createQueryContext(JdbcStatementType.UPDATE_STATEMENT_TYPE);
 
-        var cursors = processor.queryAsync(context, schema, sql, arg);
-
-        if (cursors.size() != 1) {
-            return CompletableFuture.failedFuture(new 
IgniteInternalException("Multi statement queries are not supported in 
batching"));
+        JdbcConnectionContext connectionContext;
+        try {
+            connectionContext = 
resources.get(connectionId).get(JdbcConnectionContext.class);
+        } catch (IgniteInternalCheckedException exception) {
+            return CompletableFuture.failedFuture(new 
IgniteInternalException("Connection is broken"));
         }
 
-        return cursors.get(0).thenCompose(cursor -> 
cursor.requestNextAsync(1).thenApply(batch -> (Long) 
batch.items().get(0).get(0)));
+        CompletableFuture<AsyncSqlCursor<List<Object>>> result = 
connectionContext.doInSession(sessionId -> processor.querySingleAsync(
+                sessionId,
+                context,
+                sql,
+                arg == null ? OBJECT_EMPTY_ARRAY : arg
+        ));
+
+        return result.thenCompose(cursor -> cursor.requestNextAsync(1))

Review Comment:
   not possible. Test has been added,



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to