File tree Expand file tree Collapse file tree 2 files changed +14
-8
lines changed
src/main/java/org/apache/ibatis Expand file tree Collapse file tree 2 files changed +14
-8
lines changed Original file line number Diff line number Diff line change @@ -259,14 +259,18 @@ private ResultSetWrapper getFirstResultSet(Statement stmt) throws SQLException {
259259 private ResultSetWrapper getNextResultSet (Statement stmt ) {
260260 // Making this method tolerant of bad JDBC drivers
261261 try {
262- // Crazy Standard JDBC way of determining if there are more results
263- if (stmt .getConnection ().getMetaData ().supportsMultipleResultSets ()
264- && (stmt .getMoreResults () || (stmt .getUpdateCount () != -1 ))) {
265- ResultSet rs = stmt .getResultSet ();
266- if (rs == null ) {
267- return getNextResultSet (stmt );
262+ if (stmt .getConnection ().getMetaData ().supportsMultipleResultSets ()) {
263+ // Crazy Standard JDBC way of determining if there are more results
264+ // DO NOT try to 'imporove' the condition even if IDE tells you to!
265+ // It's important that getUpdateCount() is called here.
266+ if (!(!stmt .getMoreResults () && stmt .getUpdateCount () == -1 )) {
267+ ResultSet rs = stmt .getResultSet ();
268+ if (rs == null ) {
269+ return getNextResultSet (stmt );
270+ } else {
271+ return new ResultSetWrapper (rs , configuration );
272+ }
268273 }
269- return new ResultSetWrapper (rs , configuration );
270274 }
271275 } catch (Exception e ) {
272276 // Intentionally ignored.
Original file line number Diff line number Diff line change @@ -248,7 +248,9 @@ private void executeStatement(String command) throws SQLException {
248248 }
249249 try {
250250 boolean hasResults = statement .execute (sql );
251- while ((hasResults || (statement .getUpdateCount () != -1 ))) {
251+ // DO NOT try to 'imporove' the condition even if IDE tells you to!
252+ // It's important that getUpdateCount() is called here.
253+ while (!(!hasResults && statement .getUpdateCount () == -1 )) {
252254 checkWarnings (statement );
253255 printResults (statement , hasResults );
254256 hasResults = statement .getMoreResults ();
You can’t perform that action at this time.
0 commit comments