You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ant.apache.org by bu...@apache.org on 2008/03/25 14:30:22 UTC

DO NOT REPLY [Bug 30502] SQLExec: treatment of "--" inside of strings

https://issues.apache.org/bugzilla/show_bug.cgi?id=30502





--- Comment #3 from Laurent Courtin <l....@cadwin.com>  2008-03-25 06:30:22 PST ---
Same problems with :
insert into dm_prod_macro_family (id, descr) values ('***********', '---');


Proposed correction :
Remove all strings values before making the test of comment.

Something like this :
In src/main/org/apache/tools/ant/taskdefs/SQLExec.java, replace 

            // SQL defines "--" as a comment to EOL
            // and in Oracle it may contain a hint
            // so we cannot just remove it, instead we must end it
            if (!keepformat) {
                if (line.indexOf("--") >= 0) {
                    sql.append("\n");
                }
            }

by

            // SQL defines "--" as a comment to EOL
            // and in Oracle it may contain a hint
            // so we cannot just remove it, instead we must end it
            if (!keepformat) {
                if (line.replaceAll("'.*?'", "''").indexOf("--") >= 0) {
                    sql.append("\n");
                }
            }

Regards,


-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.