xtern commented on code in PR #2906:
URL: https://github.com/apache/ignite-3/pull/2906#discussion_r1436019787
##########
modules/jdbc/src/main/java/org/apache/ignite/internal/jdbc/JdbcStatement.java:
##########
@@ -711,10 +708,25 @@ void ensureNotClosed() throws SQLException {
*
* @throws SQLException On error.
*/
- protected void closeResults() throws SQLException {
+ void closeResults() throws SQLException {
+ @Nullable JdbcResultSet last = null;
+
if (resSets != null) {
- for (JdbcResultSet rs : resSets) {
- rs.close0();
+ JdbcResultSet lastRs = resSets.get(resSets.size() - 1);
+ boolean allFetched = lastRs == null || lastRs.isClosed();
+
+ if (allFetched) {
+ for (JdbcResultSet rs : resSets) {
+ if (rs != null) {
+ rs.close0(true);
+ }
+ }
+ } else {
+ last = lastRs.getNextResultSet();
Review Comment:
as I see it, we also need to reset `resSets` and `curRes` in case of error,
otherwise the next stmt.close() will throw the same error.
--
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]