Bug 41737

Summary: sqltask: Semicolon in c-style multiline comments fails
Product: Ant Reporter: Stephen G <apache>
Component: Core tasksAssignee: Ant Notifications List <notifications>
Status: NEW ---    
Severity: minor    
Priority: P2    
Version: 1.6.5   
Target Milestone: ---   
Hardware: PC   
OS: Linux   

Description Stephen G 2007-02-28 13:49:38 UTC
When I use c-style multi-line comments in my sql source, and one of the comment 
lines ends with a semi-colon, the Ant sql core task appears to treat that as 
the end of the comment block, and then then an attempt is made to execute the 
next line in the sql source.

For example, if I have the follow sql source:
/*
  A semicolon here;
  causes a problem.
*/
select now()

The output of Ant is:
      [sql] Executing file: /home/me/test.sql
      [sql] 0 rows affected
      [sql] Failed to execute:  causes a problem. */ select now()

BUILD FAILED
/home/me/build.xml:20: java.sql.SQLException: You have an error in your SQL 
syntax; check the manual that corresponds to your MySQL server version for the 
right syntax to use near 'causes a problem. */ select now()' at line 1

Total time: 1 second
Comment 1 Steve Loughran 2007-03-01 02:13:29 UTC
If you have a look at the code inside SQL for comment handling its, well, scary. 

I'm leaving this open as it probably is a bug, but there is a lot of complex
logic there because comment syntax is so inconsistent across SQL vendors, and
Ant has to strip all of it out before creating JDBC calls.