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
**************************************************************

Reply via email to