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: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
Sent: Friday, April 07, 2006 7:19 AM
To: [email protected]
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:[EMAIL PROTECTED] 
>Gesendet: Donnerstag, 6. April 2006 22:05
>An: [email protected]
>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="[EMAIL PROTECTED]"
>srcfile="@{file}" />
>
>                                    <for delimiter="${line.separator}"
>param="@{var}" list="[EMAIL PROTECTED]">
>
>                                                <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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



**************************************************************
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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to