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

Result Sets and Errors are getting lost in SQL task with multiple statements

           Summary: Result Sets and Errors are getting lost in SQL task with
                    multiple statements
           Product: Ant
           Version: 1.5.1
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: Core tasks
        AssignedTo: [EMAIL PROTECTED]
        ReportedBy: [EMAIL PROTECTED]


The SQL task is dropping Result Sets and error messages if a script has 
multiple statements and there is an UpdateCount value between the Result Sets.  
For example, if the following batch is executed:

SELECT * FROM TableA
UPDATE TableA SET  ColumnA = 'NoValue' WHERE ColumnB = 'No Match'
INSERT INTO TableA (ColumnA, ColumnB) VALUES (NULL, NULL)
SELECT * FROM TableA
go

If we assume that ColumnA and ColumnB are NOT NULLABLE then the INSERT in the 
middle should fail and I would expect to get Results similar to the following:

{Result Set from Select *}
0 rows affected
Failed to execute ... SQLException ... ColumnA does not allow nulls...

BUILD FAILED ...

Instead what I get is something similar to the following:

{Result Set from Select *}
      [sql] 1 of 1 SQL statements executed successfully

BUILD SUCCESSFUL

In this case I don't see that there was an error at all and the subsequent 
result sets are lost.

I can get the proper response if I put 'go' (my delimiter) in between each 
statement but the case where I had this show up was actually in the execution 
of a stored procedure that had many many statements in it and the failure was 
buried pretty deep.

I was able to fix this for my purposes by updating the logic in the execSQL and 
printResults methods to better handle the boolean values from statement.execute
() and statement.getMoreResults(). I will try to post the changes that I made - 
I need to clean it up a little.

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

Reply via email to