From be45954b98d96eb6e208211ef8c323886b88b2ee Mon Sep 17 00:00:00 2001 From: Stephane Bailliez Date: Thu, 11 Nov 2004 18:46:36 +0000 Subject: [PATCH] Avoid calling getResultSet() multiple times when printing just in case 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 --- src/main/org/apache/tools/ant/taskdefs/SQLExec.java | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/main/org/apache/tools/ant/taskdefs/SQLExec.java b/src/main/org/apache/tools/ant/taskdefs/SQLExec.java index c04202407..af90caee8 100644 --- a/src/main/org/apache/tools/ant/taskdefs/SQLExec.java +++ b/src/main/org/apache/tools/ant/taskdefs/SQLExec.java @@ -527,7 +527,7 @@ public class SQLExec extends JDBCTask { } } else { if (print) { - printResults(out); + printResults(resultSet, out); } } ret = statement.getMoreResults(); @@ -563,13 +563,12 @@ public class SQLExec extends JDBCTask { } /** - * 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();