ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ivan Ivanov <rambiusparkisan...@yahoo.com>
Subject Re: Commenting sql statments - required support from Ant
Date Wed, 14 Apr 2004 08:23:30 GMT

> Hi all,
> 
> I am executing an sql file as follows:
> 
> <sql userid="${USERNAME}" password="${PASSWORD}"
> url="${CONNECTSTRING}"
> driver="${DRIVER}"
> autocommit="true" src="mysql-dump.sql">
> </sql>
> 
> With the above snippet of code I tried to execute a
> mysql dump file. It gave
> an sql fail error. Ant ignores
> lines starting with -- or // or REM words. But mysql
> dump file contains # as
> comments. Now I wanted to
> tell the ant that "ignore the lines starting with
> this particular character
> or word". Is there any way to do?

Yes there is. Here is the snippet:

        <copy todir="${project.dist.dir}/sql">
            <fileset dir="${basedir}/sql">
                <include name="create.sql"/>
                <include name="insert.sql"/>
            </fileset>
            <filterchain>
                <striplinecomments>
                    <comment value="#"/>
                </striplinecomments>
            </filterchain>
        </copy>

The important work is done with the nested filterchain
in the copy task [2]: The Copy task supports nested
FilterChains (from [1]).

Hope this helps
Ivan

[1]http://ant.apache.org/manual/CoreTasks/copy.html
[2]http://ant.apache.org/manual/CoreTypes/filterchain.html


	
		
__________________________________
Do you Yahoo!?
Yahoo! Tax Center - File online by April 15th
http://taxes.yahoo.com/filing.html

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


Mime
View raw message