ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jack J. Woehr" <...@purematrix.com>
Subject Re: Commenting sql statments - required support from Ant
Date Wed, 14 Apr 2004 08:16:26 GMT
Chandu wrote:

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

Not currently. A commentstring="#" attribute might be nice for the SQL task.
But you could simply add that to the SQLExec class and rebuild Ant!!! Here's
a diff that would do that. This diff is against the current source tree:

Index: src/main/org/apache/tools/ant/taskdefs/SQLExec.java
===================================================================
RCS file: /home/cvspublic/ant/src/main/org/apache/tools/ant/taskdefs/SQLExec.java,v
retrieving revision 1.67
diff -u -r1.67 SQLExec.java
--- src/main/org/apache/tools/ant/taskdefs/SQLExec.java 23 Feb 2004 19:28:23 -0000      1.67
+++ src/main/org/apache/tools/ant/taskdefs/SQLExec.java 14 Apr 2004 08:14:41 -0000
@@ -457,6 +457,9 @@
                 if (line.startsWith("--")) {
                     continue;
                 }
+                if (line.startsWith("#")) {
+                    continue;
+                }
                 StringTokenizer st = new StringTokenizer(line);
                 if (st.hasMoreTokens()) {
                     String token = st.nextToken();


--
Jack J. Woehr      # We have gone from the horse and buggy
Senior Consultant  # to the moon rocket in one lifetime, but
Purematrix, Inc.   # there has not been a corresponding moral
www.purematrix.com # growth in mankind. - Dwight D. Eisenhower




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


Mime
View raw message