Skip to content

Commit

Permalink
Avoid calling getResultSet() multiple times when printing just in cas…
Browse files Browse the repository at this point in the history
…e Informix does not like it. This was per suggestion of Bohuslav Roztocil.

PR: 27162


git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@277018 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
sbailliez committed Nov 11, 2004
1 parent 9f4bad1 commit 4668c46
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/main/org/apache/tools/ant/taskdefs/SQLExec.java
Original file line number Diff line number Diff line change
Expand Up @@ -527,7 +527,7 @@ protected void execSQL(String sql, PrintStream out) throws SQLException {
}
} else {
if (print) {
printResults(out);
printResults(resultSet, out);
}
}
ret = statement.getMoreResults();
Expand Down Expand Up @@ -563,13 +563,12 @@ protected void execSQL(String sql, PrintStream out) throws SQLException {
}

/**
* print any results in the statement.
* print any results in the result set.
* @param rs the resultset to print information about
* @param out the place to print results
* @throws SQLException on SQL problems.
*/
protected void printResults(PrintStream out) throws SQLException {
ResultSet rs = null;
rs = statement.getResultSet();
protected void printResults(ResultSet rs, PrintStream out) throws SQLException {
if (rs != null) {
log("Processing new result set.", Project.MSG_VERBOSE);
ResultSetMetaData md = rs.getMetaData();
Expand Down

0 comments on commit 4668c46

Please sign in to comment.