Hello,

I'd like to propose an addition of a new attribute to the SQLExec.class
in src\main\org\apache\tools\ant\taskdefs of ant version 1.6.1. This
attribute would emulate 'set feedback off' in Oracle's sqlplus. Without
it the 'n rows affected' message is produced in the output.

It is sometimes necessary, as in my case, to use the output file of one
sql task as source for another. For example to migrate certain settings
between the staging database and the production database, one would
extract the data with a sql statement like this:

select 'update owner.table set column='||column||' where ...

Then a separapte ant import project would pickup the ouput (an update
statement) and execute it against the target database. However, with the
1.6.1 version of ant, the file will contain 'n rows affected' message,
which will cause an error upon subsequent execution.

Attached is the output of diff -Naur for the SQLExec.class file that I'm
using to do this in my environment.

I'd appreciate any feedback you may have.

Max Pakhutkin
Database Administrator (OCA)
Computer Services
University of South Carolina


---
apache-ant-1.6.1/src/main/org/apache/tools/ant/taskdefs/SQLExec.java    
2004-02-12
13:33:24.000000000 -0500
+++
apache-ant-new/src/main/org/apache/tools/ant/taskdefs/SQLExec.java      
2004-07-03
11:06:37.138125000 -0400
@@ -142,6 +142,12 @@
     private boolean print = false;
 
     /**
+     * Print RDBMS informational (feedback) output.
+     * Used jointly with print
+     */
+    private boolean feedback = false;
+    
+    /**
      * Print header columns.
      */
     private boolean showheaders = true;
@@ -253,6 +259,14 @@
     }
 
     /**
+     * Print RDBMS feedback (N rows affected, etc)
+     * optional, only used if print is true, default true
+     */
+    public void setFeedback(boolean feedback) {
+           this.feedback = feedback;
+    }
+    
+    /**
      * Print headers for result sets from the
      * statements; optional, default true.
      */
@@ -522,7 +536,7 @@
             log(updateCountTotal + " rows affected",
                 Project.MSG_VERBOSE);
 
-            if (print) {
+            if (print && feedback) {
                 StringBuffer line = new StringBuffer();
                 line.append(updateCountTotal + " rows affected");
                 out.println(line);


Max Pakhutkin
Database Administrator (OCA)
Computer Services
University of South Carolina
803-777-8089
AIM: pakhutkinusc

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to