zstan commented on code in PR #2906:
URL: https://github.com/apache/ignite-3/pull/2906#discussion_r1434124247


##########
modules/jdbc/src/main/java/org/apache/ignite/internal/jdbc/JdbcStatement.java:
##########
@@ -460,33 +440,53 @@ public boolean getMoreResults() throws SQLException {
     public boolean getMoreResults(int curr) throws SQLException {
         ensureNotClosed();
 
-        if (resSets == null || curRes >= resSets.size()) {
-            return false;
-        }
-
-        curRes++;
-
         if (resSets != null) {
             assert curRes <= resSets.size() : "Invalid results state: 
[resultsCount=" + resSets.size() + ", curRes=" + curRes + ']';
 
             switch (curr) {
                 case CLOSE_CURRENT_RESULT:
-                    if (curRes > 0) {
-                        resSets.get(curRes - 1).close0();
-                    }
-
                     break;
 
                 case CLOSE_ALL_RESULTS:
                 case KEEP_CURRENT_RESULT:
                     throw new SQLFeatureNotSupportedException("Multiple open 
results is not supported.");
 
                 default:
-                    throw new SQLException("Invalid 'current' parameter.");
+                    throw new SQLException("Invalid 'curr' parameter.");
             }
         }
 
-        return (resSets != null && curRes < resSets.size());
+        // all previous results need to be closed at this point.
+        if (isCloseOnCompletion()) {
+            close();
+            return false;
+        }
+
+        if (resSets == null || curRes >= resSets.size() || resSets.get(curRes) 
== null) {
+            return false;
+        }
+
+        JdbcResultSet nextResultSet;
+        SQLException exceptionally = null;
+
+        try {
+            // just a stub if exception is raised inside multiple statements.
+            // all further execution is not processed.
+            nextResultSet = resSets.get(curRes).getNextResultSet();
+        } catch (SQLException ex) {
+            nextResultSet = null;
+            exceptionally = ex;
+        }
+
+        resSets.add(nextResultSet);
+
+        curRes++;
+
+        if (exceptionally != null) {
+            throw exceptionally;
+        }
+
+        return nextResultSet != null && nextResultSet.holdResults();

Review Comment:
   changed, not here but logic at all



##########
modules/jdbc/src/main/java/org/apache/ignite/internal/jdbc/JdbcStatement.java:
##########
@@ -460,33 +440,53 @@ public boolean getMoreResults() throws SQLException {
     public boolean getMoreResults(int curr) throws SQLException {
         ensureNotClosed();
 
-        if (resSets == null || curRes >= resSets.size()) {
-            return false;
-        }
-
-        curRes++;
-
         if (resSets != null) {
             assert curRes <= resSets.size() : "Invalid results state: 
[resultsCount=" + resSets.size() + ", curRes=" + curRes + ']';
 
             switch (curr) {
                 case CLOSE_CURRENT_RESULT:
-                    if (curRes > 0) {
-                        resSets.get(curRes - 1).close0();
-                    }
-
                     break;
 
                 case CLOSE_ALL_RESULTS:
                 case KEEP_CURRENT_RESULT:
                     throw new SQLFeatureNotSupportedException("Multiple open 
results is not supported.");
 
                 default:
-                    throw new SQLException("Invalid 'current' parameter.");
+                    throw new SQLException("Invalid 'curr' parameter.");

Review Comment:
   done



-- 
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