Skip to content

Commit

Permalink
Merge pull request #69 from woehrl01/multiresultset_update
Browse files Browse the repository at this point in the history
0003487: Executing ISqlTemplate.update() with multiple statements swallows errors
  • Loading branch information
mmichalek committed Mar 13, 2018
2 parents d84e933 + 6694591 commit d1eb739
Showing 1 changed file with 12 additions and 2 deletions.
Expand Up @@ -352,7 +352,12 @@ public Integer execute(Connection con) throws SQLException {
long endTime = System.currentTimeMillis();
logSqlBuilder.logSql(log, sql, args, types, (endTime-startTime));

return stmt.getUpdateCount();
int updateCount;
do{
updateCount = stmt.getUpdateCount();
}while(stmt.getMoreResults() || stmt.getUpdateCount() != -1);

return updateCount;
} catch (SQLException e) {
throw logSqlBuilder.logSqlAfterException(log, sql, args, e);
} finally {
Expand All @@ -375,7 +380,12 @@ public Integer execute(Connection con) throws SQLException {
long endTime = System.currentTimeMillis();
logSqlBuilder.logSql(log, sql, args, types, (endTime-startTime));

return ps.getUpdateCount();
int updateCount;
do{
updateCount = ps.getUpdateCount();
}while(ps.getMoreResults() || ps.getUpdateCount() != -1);

return updateCount;
} catch (SQLException e) {
throw logSqlBuilder.logSqlAfterException(log, sql, args, e);
} finally {
Expand Down

0 comments on commit d1eb739

Please sign in to comment.