ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 21858] New: - Improper handling of "--" comments in the <sql> task
Date Thu, 24 Jul 2003 16:10:24 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=21858>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=21858

Improper handling of "--" comments in the <sql> task

           Summary: Improper handling of "--" comments in the <sql> task
           Product: Ant
           Version: 1.5.3
          Platform: Other
        OS/Version: Windows NT/2K
            Status: NEW
          Severity: Critical
          Priority: Other
         Component: Core tasks
        AssignedTo: dev@ant.apache.org
        ReportedBy: razvan.surdulescu@post.harvard.edu


There is a problem in the way the <sql> task handles "--" comments.

Consider the following example of a .sql file fragment:

...
select * from people; -- show me some people

select * from plants; -- show me some plants
...

Note that there is a newline between the two select statements above.

On line 460 of SQLExec.java, the code will detect that the first line contains 
a "--" so it will continue as if the statement has not yet completed (even 
though the "--" is preceded by a ";" that should normally end the statement).

Thus far, the "sql" variable contains "select * from people; -- show me some 
people\n"

The next line in the file is an empty line, so, on line 454, the "sql" variable 
will contain "select * from people; -- show me some people\n \n", and on line 
454 (after the .trim()) the "sql" variable will contain "select * from people; -
- show me some people"

Note that the sql statement is still not considered to have ended thus far.

We now move on to the next line in the .sql file, where the sql statement 
becomes:

"select * from people; -- show me some people select * from plants; -- show me 
some plants"

This new statement is already invalid: the second select is commented out since 
it follows on the same line as "--"!

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


Mime
View raw message