Bug 41737 - sqltask: Semicolon in c-style multiline comments fails
Summary: sqltask: Semicolon in c-style multiline comments fails
Status: NEW
Alias: None
Product: Ant
Classification: Unclassified
Component: Core tasks (show other bugs)
Version: 1.6.5
Hardware: PC Linux
: P2 minor with 1 vote (vote)
Target Milestone: ---
Assignee: Ant Notifications List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-02-28 13:49 UTC by Stephen G
Modified: 2008-02-22 12:18 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
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.