Skip to content

Commit 830741d

Browse files
committed
fix multipleResultsetSets bug
fix multipleResultsetSets bug,when ((stmt.getMoreResults() or stmt.getUpdateCount()!=-1) and stmt.getResultSet()==null),will stop check the succedent resultsets and the succedent resultsets will be lost.
1 parent 4f0eef2 commit 830741d

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/main/java/org/apache/ibatis/executor/resultset/DefaultResultSetHandler.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -253,9 +253,13 @@ private ResultSetWrapper getNextResultSet(Statement stmt) throws SQLException {
253253
try {
254254
if (stmt.getConnection().getMetaData().supportsMultipleResultSets()) {
255255
// Crazy Standard JDBC way of determining if there are more results
256-
if (!((!stmt.getMoreResults()) && (stmt.getUpdateCount() == -1))) {
256+
if (stmt.getMoreResults() || stmt.getUpdateCount() != -1) {
257257
ResultSet rs = stmt.getResultSet();
258-
return rs != null ? new ResultSetWrapper(rs, configuration) : null;
258+
if (rs == null) {
259+
return getNextResultSet(stmt);
260+
} else {
261+
return new ResultSetWrapper(rs, configuration);
262+
}
259263
}
260264
}
261265
} catch (Exception e) {

0 commit comments

Comments
 (0)