ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Guttula, Mohan" <MGutt...@tiaa-cref.org>
Subject RE: Looping through a file contents and dynamically add <transaction> for each line in the file to <SQL> task
Date Sun, 09 Apr 2006 05:22:51 GMT
Hello Jan,

How do I create the project.xml? Is this Manual Process or do you want me to create java class
that will dynamically create the project.xml?

As mentioned earlier, I have to call SQL task once and compile all the files in "sample.sql".

Thanks,
Mohan

-----Original Message-----
From: Guttula, Mohan 
Sent: Friday, April 07, 2006 10:32 AM
To: Ant Users List
Subject: RE: Looping through a file contents and dynamically add <transaction> for each
line in the file to <SQL> task

Thank you for your Response. 

Part of my requirement is to call the "SQL" task only once and add as many "<transaction>"
elements as the number of lines in "sample.sql".

Note: "Sample.sql" contains other sql file names as mentioned in my first e-mail.

Mohan

-----Original Message-----
From: Jan.Materne@rzf.fin-nrw.de [mailto:Jan.Materne@rzf.fin-nrw.de] 
Sent: Friday, April 07, 2006 7:19 AM
To: user@ant.apache.org
Subject: AW: Looping through a file contents and dynamically add <transaction> for each
line in the file to <SQL> task

1. Create a child project
  - input: the names of the sql files
  - create a project.xml file containing just that target
2. use <antcall> to call that (new) project

Jan 

>-----Urspr√ľngliche Nachricht-----
>Von: Guttula, Mohan [mailto:MGuttula@tiaa-cref.org] 
>Gesendet: Donnerstag, 6. April 2006 22:05
>An: user@ant.apache.org
>Betreff: Looping through a file contents and dynamically add 
><transaction> for each line in the file to <SQL> task
>
>Hello All,
>
> 
>
>I have a "sample.sql" file (this file contents change 
>dynamically) that contains the following lines:
>
>------
>
>release\Country.sql
>
>release\State.sql
>
>release\City.sql
>
>-------
>
> 
>
><target name="sql-oracle">
>
><sql
>
>                        driver="oracle.jdbc.driver.OracleDriver"
>
>                        delimiter="/"
>
>                        delimitertype="row"
>
>                        keepformat="true"
>
> 
>url="jdbc:oracle:thin:@${machine_name}:1521:${database_Instance_name}"
>
>                        userid="${user_name}"
>
>                        password="${password}"
>
>                        >
>
>                        <transaction src=" release\Country.sql"/>
>
><transaction src=" release\State.sql"/>
>
><transaction src=" release\City.sql"/>
>
>                        <classpath>
>
>                                    <pathelement
>location="C:/oracle/ora92/jdbc/lib/classes12.jar"/>      
>
>                                    <fileset 
>dir="C:/apache-ant-1.6.5/lib">
>
>                                    <include name="**/*.jar"/>
>
>                                    </fileset>
>
>                        </classpath>
>
>            </sql>
>
></target>
>
> 
>
>I have found following loop through logic from 
>http://www.ant-tasks.com/msg/17209.html
>
>-----
>
><macrodef name="foreach-line">
>
><attribute name="file" />
>
>                        <attribute name="var" default="line" />
>
>                        <element name="body" implicit="true" />
>
>                        <sequential>
>
>                                    <loadfile property="lines4@{file}"
>srcfile="@{file}" />
>
>                                    <for delimiter="${line.separator}"
>param="@{var}" list="${lines4@{file}}">
>
>                                                <sequential>
>
>                                                            <body />
>
>                                                </sequential>
>
>                                    </for>
>
>                        </sequential>
>
></macrodef>
>
>-----
>
> 
>
>How can I use the above "microdef" and dynamically add 
><transaction> for each line in "sample.sql" to the target 
>"sql-oracle" ( I have to follow order of the lines in the 
>"sample.sql")?
>
>Is there a better way to achieve what I want using some other task? 
>
> 
>
>Thanks,
>
>Mohan
>
> 
>
>
>
>**************************************************************
>This message, including any attachments, contains confidential 
>information intended for a specific individual and purpose, 
>and is protected by law.  If you are not the intended 
>recipient, please contact sender immediately by reply e-mail 
>and destroy all copies.  You are hereby notified that any 
>disclosure, copying, or distribution of this message, or the 
>taking of any action based on it, is strictly prohibited.
>TIAA-CREF
>**************************************************************
>
>

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



**************************************************************
This message, including any attachments, contains confidential information intended for a
specific individual and purpose, and is protected by law.  If you are not the intended recipient,
please contact sender immediately by reply e-mail and destroy all copies.  You are hereby
notified that any disclosure, copying, or distribution of this message, or the taking of any
action based on it, is strictly prohibited.
TIAA-CREF
**************************************************************


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



**************************************************************
This message, including any attachments, contains confidential information intended for a
specific individual and purpose, and is protected by law.  If you are not the intended recipient,
please contact sender immediately by reply e-mail and destroy all copies.  You are hereby
notified that any disclosure, copying, or distribution of this message, or the taking of any
action based on it, is strictly prohibited.
TIAA-CREF
**************************************************************


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


Mime
View raw message