Browse Source

fix resultset und update count logic in sql. PRs 32168 and 36265.

git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@675909 13f79535-47bb-0310-9956-ffa450edef68
master
Stefan Bodewig 17 years ago
parent
commit
543148ca1d
2 changed files with 20 additions and 10 deletions
  1. +12
    -0
      WHATSNEW
  2. +8
    -10
      src/main/org/apache/tools/ant/taskdefs/SQLExec.java

+ 12
- 0
WHATSNEW View File

@@ -89,6 +89,18 @@ Fixed bugs:
have full control.
Bugzilla Report 34638.

* <sql> 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 <sql> returned a result set and an
update count, the count would be lost.

* if an executed statement in <sql> mixes update count and result set
parts, some result sets wouldn't get printed.
Bugzilla Report 32168.

Other changes:
--------------



+ 8
- 10
src/main/org/apache/tools/ant/taskdefs/SQLExec.java View File

@@ -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);



Loading…
Cancel
Save