Skip to content

Commit

Permalink
Don't return -1 when performing an update and a result set is returned.
Browse files Browse the repository at this point in the history
  • Loading branch information
abrougher committed Mar 17, 2013
1 parent 4e4ab0f commit 3c881f4
Showing 1 changed file with 5 additions and 2 deletions.
Expand Up @@ -286,7 +286,8 @@ public Integer execute(Connection con) throws SQLException {
stmt = con.createStatement();
stmt.setQueryTimeout(settings.getQueryTimeout());
stmt.execute(sql);
return stmt.getUpdateCount();
int updateCount = stmt.getUpdateCount();
return updateCount > 0 ? updateCount : 0;
} finally {
close(stmt);
}
Expand All @@ -302,7 +303,8 @@ public Integer execute(Connection con) throws SQLException {
setValues(ps, args);
}
ps.execute();
return ps.getUpdateCount();
int updateCount = ps.getUpdateCount();
return updateCount > 0 ? updateCount : 0;
} finally {
close(ps);
}
Expand Down Expand Up @@ -338,6 +340,7 @@ public Integer execute(Connection con) throws SQLException {
try {
boolean hasResults = stmt.execute(statement);
int updateCount = stmt.getUpdateCount();
updateCount = updateCount > 0 ? updateCount : 0;
totalUpdateCount += updateCount;
int rowsRetrieved = 0;
if (hasResults) {
Expand Down

0 comments on commit 3c881f4

Please sign in to comment.