You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Carlos Alonso <ca...@unkasoft.com> on 2008/05/16 18:57:57 UTC

Executing a sorted fileset of .sql files in sql task

Hi everyone.

I'm looking for an automated way to execute a set of .sql files inside a 
sql task and I do need them to be executed in order. The ant task I've 
tried is the following

<sql
           driver = "com.mysql.jdbc.Driver"
           password = "root"
           url = "jdbc:mysql://127.0.0.1/"
           userid = "root"
           autocommit = "true"
           classpath = "${lib}/mysql-connector-java-5.0.4-bin.jar"
           >
           <transaction>
                  <sort>
                           <fileset dir="${sources.dir}" 
includes="*.sql" />
                  </sort>
            </transaction>
       </sql>

But I get the following error  "only single argument resource 
collections are supported."
I've been looking over Google for possible solutions or examples, but 
I've seen no answer. Could anyone help?

Thanks.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Re: Executing a sorted fileset of .sql files in sql task

Posted by Carlos Alonso <ca...@unkasoft.com>.
Thank you very much Andrew. It works fine!

Andrew Goktepe escribió:
> Carlos,
>
> That message is coming from the <transaction> element, which apparently does
> not support a nested <sort>.  The Ant documentation matches the error
> message you are seeing and says that <transaction> only supports single
> element resource collections (
> http://ant.apache.org/manual/CoreTasks/sql.html).
>
> Try removing <transaction> so that your <sort> is nested directly within
> <sql>.  According to the Ant docs for <sql> each resource from a nested
> resource collection is automatically run in its own transaction.
>
> -Andrew
>
> On Fri, May 16, 2008 at 11:57 AM, Carlos Alonso <ca...@unkasoft.com>
> wrote:
>
>   
>> Hi everyone.
>>
>> I'm looking for an automated way to execute a set of .sql files inside a
>> sql task and I do need them to be executed in order. The ant task I've tried
>> is the following
>>
>> <sql
>>          driver = "com.mysql.jdbc.Driver"
>>          password = "root"
>>          url = "jdbc:mysql://127.0.0.1/"
>>          userid = "root"
>>          autocommit = "true"
>>          classpath = "${lib}/mysql-connector-java-5.0.4-bin.jar"
>>          >
>>          <transaction>
>>                 <sort>
>>                          <fileset dir="${sources.dir}" includes="*.sql" />
>>                 </sort>
>>           </transaction>
>>      </sql>
>>
>> But I get the following error  "only single argument resource collections
>> are supported."
>> I've been looking over Google for possible solutions or examples, but I've
>> seen no answer. Could anyone help?
>>
>> Thanks.
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
>> For additional commands, e-mail: user-help@ant.apache.org
>>
>>
>>     
>
>   


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Re: Executing a sorted fileset of .sql files in sql task

Posted by Andrew Goktepe <an...@gmail.com>.
Carlos,

That message is coming from the <transaction> element, which apparently does
not support a nested <sort>.  The Ant documentation matches the error
message you are seeing and says that <transaction> only supports single
element resource collections (
http://ant.apache.org/manual/CoreTasks/sql.html).

Try removing <transaction> so that your <sort> is nested directly within
<sql>.  According to the Ant docs for <sql> each resource from a nested
resource collection is automatically run in its own transaction.

-Andrew

On Fri, May 16, 2008 at 11:57 AM, Carlos Alonso <ca...@unkasoft.com>
wrote:

> Hi everyone.
>
> I'm looking for an automated way to execute a set of .sql files inside a
> sql task and I do need them to be executed in order. The ant task I've tried
> is the following
>
> <sql
>          driver = "com.mysql.jdbc.Driver"
>          password = "root"
>          url = "jdbc:mysql://127.0.0.1/"
>          userid = "root"
>          autocommit = "true"
>          classpath = "${lib}/mysql-connector-java-5.0.4-bin.jar"
>          >
>          <transaction>
>                 <sort>
>                          <fileset dir="${sources.dir}" includes="*.sql" />
>                 </sort>
>           </transaction>
>      </sql>
>
> But I get the following error  "only single argument resource collections
> are supported."
> I've been looking over Google for possible solutions or examples, but I've
> seen no answer. Could anyone help?
>
> Thanks.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
>
>