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=21365>.
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=21365

sql task trims newline with inline comments.

           Summary: sql task trims newline with inline comments.
           Product: Ant
           Version: 1.5.3
          Platform: Other
        OS/Version: Other
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: Core tasks
        AssignedTo: [EMAIL PROTECTED]
        ReportedBy: [EMAIL PROTECTED]


The following is a pseudo code style PL/SQL block. When stored in a file and 
run using sql task on oracle. the sp becomes invalid (status) as the sql task 
has an issue.

create or replace sp_add( a int )

as

begin 

if a > 10 then
   a := 10 -- this comment is just to replicate issues.
end if

return a + 100;

end;

The problem is in SQLExec.java Line 454 onwards is

            sql += " " + line;
            sql = sql.trim(); /// GOTCHA HERE....REMOVES NEWLINE added below.
            
            // 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 (line.indexOf("--") >= 0) {
                sql += "\n"; /// THIS WOULD HAVE ADDED THE NEWLINE
            }

Apparently, there is a line.trim() already being done earlier in the while 
loop, so I dont think a sql.trim() is required here...

Thanks And Regards
Arun N Kumar

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to