In escence the SQL task just passes the lines to JDBC.
You could just use <script/> and call JDBC to do whatever you want.
You may avoid the need for piping or anything that way.

In my build here I use beanshell scripting and go do whatever
I need to do. My problem with your request is that is like
asking for the <javac/> task to have parameters to not show this or that
because we want to postprocess the output for our own purposes; 
which at some point becomes unreasonable.

To tell you the truth, I think the whole business of printing
results of queries using SQLTask was a mistake, and should have
been defined on a separate task that can do real XML output of
results that one can manipulate and format in watever fashion. 
The current arrangement is a product of the early days of ANT.

Alternatively, have you looked at using filters to postprocess,
the output, you can do a lot with them.

Jose Alberto

> -----Original Message-----
> From: Maksim Pakhutkin [mailto:[EMAIL PROTECTED] 
> Sent: 05 July 2004 11:17
> To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
> Subject: RE: SQLExec.class feedback attribute proposal
> 
> 
> Hmmm... What I am actually proposing is that the task _not_ 
> do something, that is, not print 'X rows affected'. I am not 
> proposing adding a new feature that is Oracle/PL-SQL 
> specific. The 'X rows affected' is generated by the SQLTask, 
> not the RDBMS (although I think I got a little confused when 
> writing the comments in the patch).
> 
> The only way for me to handle this without patching ant would 
> be to run a separate task after each sql "export" task, which 
> would pipe the output file of the sql task through a perl 
> command line or some such to strip out the 'X rows affected' message.
> 
> I think it only makes sense that there be a parameter for 
> printing the actual output of the sql task and another to 
> optionally print any information messages such as 'X rows affected'.
> 
> But I'm not going to insist on anything here, obviously. I am 
> perfectly comfortable patching ant for my own purposes, just 
> thought that other people _might_ find the suggestion useful also.
> 
> Max Pakhutkin
> Database Administrator (OCA)
> Computer Services
> University of South Carolina
> 803-777-8089
> AIM: pakhutkinusc
> >>> [EMAIL PROTECTED] 07/05/04 05:52 AM >>>
> I think these increasing types of functionality have
> been asked before for the SQLTask.
> 
> I really think people are asking for the SQLTask to be as 
> flexible as a scripting language (like sqlplus or PL/SQL) 
> which is not what the task how the task was originally conceived.
> 
> As a result there are more and more options and complexities 
> in the task which I think are creating a moster out of it. 
> Maybe we should think on defining a new task designed for 
> JDBCScripting closer in functionality with what one can do in 
> other scripting languages.
> 
> On the other hand, maybe you should just use one of those 
> scripting languages with JDBC calls to do what you want. Hmmmmm
> 
> Jose Alberto
> 
> > -----Original Message-----
> > From: Maksim Pakhutkin [mailto:[EMAIL PROTECTED]
> > Sent: 03 July 2004 16:56
> > To: [EMAIL PROTECTED]
> > Subject: SQLExec.class feedback attribute proposal
> > 
> > 
> > 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/SQLEx
> > ec.java     2004-02-12
> > 13:33:24.000000000 -0500
> > +++
> > apache-ant-new/src/main/org/apache/tools/ant/taskdefs/SQLEx
> > ec.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]
> > 
> > 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 

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

Reply via email to