ant-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 30502] SQLExec: treatment of "--" inside of strings
Date Tue, 25 Mar 2008 13:30:22 GMT
https://issues.apache.org/bugzilla/show_bug.cgi?id=30502





--- Comment #3 from Laurent Courtin <l.courtin@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.

Mime
View raw message