You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by "Julian M. Savage" <js...@fisci.com> on 2000/09/22 12:18:07 UTC

[PATCH] Print SQL to System.out or output file

Here's a patch to to the SQLExec.java which adds the ability to pipe the results of SQL statements executed with <sql/> to a file or the screen. It simply prints the output as comma delimited values, optionally printing the headers. I wrote it thinking of using it to write queries which generate sql statements which can then be fed back into <sql/> directive a second time.

Here is sample usage:

                <sql
                        driver="${db.driver}"
                        url="${db.url}"
                        userid="${db.userid}"
                        password="${db.password}"
                        print="yes"
                        showheaders="no"
                        output="output.txt">
                select count(*) from footable
                </sql>

Julian.


R: [PATCH] Print SQL to System.out or output file

Posted by Tomasini Andrea <an...@nch.it>.
  Here's a patch to to the SQLExec.java which adds the
ability to pipe the results of SQL statements executed with
<sql/> to a file or the screen. It simply prints the output
as comma delimited values, optionally printing the headers.
I wrote it thinking of using it to write queries which
generate sql statements which can then be fed back into
<sql/> directive a second time.

  Here is sample usage:

                  <sql
                          driver="${db.driver}"
                          url="${db.url}"
                          userid="${db.userid}"
                          password="${db.password}"
                          print="yes"
                          showheaders="no"
                          output="output.txt">
                  select count(*) from footable
                  </sql>

  Very Good!! What about adding a classpath attribute to
locate multiple JDBC Drivers??

  Byez
  ANdreaT