diff --git a/WHATSNEW b/WHATSNEW index f1dc60d35..9dbe31342 100644 --- a/WHATSNEW +++ b/WHATSNEW @@ -89,6 +89,18 @@ Fixed bugs: have full control. Bugzilla Report 34638. + * would fail if the executed statment didn't return a result + set with some JDBC driver that dissalow Statement.getResultSet to + be called in such a situation. + Bugzilla report 36265 + + * if the executed statement in returned a result set and an + update count, the count would be lost. + + * if an executed statement in mixes update count and result set + parts, some result sets wouldn't get printed. + Bugzilla Report 32168. + Other changes: -------------- diff --git a/src/main/org/apache/tools/ant/taskdefs/SQLExec.java b/src/main/org/apache/tools/ant/taskdefs/SQLExec.java index 53b315319..14b821968 100644 --- a/src/main/org/apache/tools/ant/taskdefs/SQLExec.java +++ b/src/main/org/apache/tools/ant/taskdefs/SQLExec.java @@ -571,21 +571,19 @@ public class SQLExec extends JDBCTask { ret = getStatement().execute(sql); updateCount = getStatement().getUpdateCount(); - resultSet = getStatement().getResultSet(); do { - if (!ret) { - if (updateCount != -1) { - updateCountTotal += updateCount; - } - } else if (print) { - printResults(resultSet, out); + if (updateCount != -1) { + updateCountTotal += updateCount; } - ret = getStatement().getMoreResults(); if (ret) { - updateCount = getStatement().getUpdateCount(); resultSet = getStatement().getResultSet(); + if (print) { + printResults(resultSet, out); + } } - } while (ret); + ret = getStatement().getMoreResults(); + updateCount = getStatement().getUpdateCount(); + } while (ret || updateCount != -1); log(updateCountTotal + " rows affected", Project.MSG_VERBOSE);