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

SQLTransformer fails to return number of rows updated

           Summary: SQLTransformer fails to return number of rows updated
           Product: Cocoon 2
           Version: 2.1.3
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: Major
          Priority: Other
         Component: general components
        AssignedTo: [EMAIL PROTECTED]
        ReportedBy: [EMAIL PROTECTED]


The SQLTransformer fails to return the number of rows updated as a result of an 
INSERT, UPDATE or DELETE statement. 
 
The SQLTransformer.Query.serializeRows method will return the number of updated 
rows as a returncode attribute but it is never called for update queries. 
 
The following code fragment from SQLTransform.executeQuery processes the 
results from the query: 
 
361                if ( !query.isStoredProcedure() ) { 
362                    while ( query.next() ) { 
363                        this.start( query.row_name, attr ); 
364                        query.serializeRow(this.manager); 
365                        if ( index + 1 < queries.size() ) { 
366                            executeQuery( index + 1 ); 
367                        } 
368                        this.end( query.row_name ); 
369                    } 
370                } 
 
The SQLTransformer.Query.next method always returns false for any update query 
and therefore query.serializeRow is never called and the results are never 
reported. 
 
It also suggests that any queries after an update query will never be executed 
as well. 
 
As a general comment, the use of recursion in this part of the code 
(executeQuery calls itself) is poor coding form.  It is not necessary, could be 
done simpler with a while loop and results in tangles like the one described.

Reply via email to