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]

Reply via email to