<snip/> > > getMoreResults() should return no resultset at all... but how to iterate > > to the next update count? again - it belongs to the statement... > > I read the JDBC API that way that getMoreResults() closes the current > ResultSet and switches to the next result. A result consists among > others of a ResultSet and an UpdateCount. At least I get the > impression from the docs. So, if a complex statement i.e. a stored > procedure produces several results, why shouldn't it return several > update counts as well?
... > So with the scenario above, it would still work as each call to > getMoreResults() would switch to the next result. Incidently > containing no result set but an update count. makes sense... I also looked into the code I guess we should change it into something like this then: do { if (_esql_query.hasResultSet()) { _esql_query.getResultRows(); if (_esql_query.nextRow()) { <xsl:apply-templates select="esql:results"/> } else { <xsl:apply-templates select="esql:no-results"/> } _esql_query.getResultSet().close(); } else { if (_esql_query.getStatement().getUpdateCount() > 0) { <xsl:apply-templates select="esql:update-results/*"/> } else{ <xsl:apply-templates select="esql:no-results"/> } } } while(_esql_query.getMoreResults()); what do you think? <snip/> > Is it? AFAIK we evalute the <esql:results/> block for each result. How > would I write different code for each result? sorry, looking at the code revealed I didn't recalle correctly... the structure of results has to be same... you were right... We could work around by wrapping the esql:results in a switch/case statement so with multiple resultset it would get expanded into: int _esql_resultset_nr = 0; do { if (_esql_query.hasResultSet()) { _esql_query.getResultRows(); if (_esql_query.nextRow()) { switch(_esql_resultset_nr++) { case 1: /* resultset position() = 1 goes here */ break; case 2: /* resultset position() = 2 goes here */ break; ... } } else { <xsl:apply-templates select="esql:no-results"/> } _esql_query.getResultSet().close(); } else { if (_esql_query.getStatement().getUpdateCount() > 0) { <xsl:apply-templates select="esql:update-results/*"/> } else{ <xsl:apply-templates select="esql:no-results"/> } } } while(_esql_query.getMoreResults()); So all you whould need to do is to specify multiple esql:results which get applied in the order of appearance. What do you think? -- Torsten PS:maybe we should better move this discussion to cocoon-dev --------------------------------------------------------------------- Please check that your question has not already been answered in the FAQ before posting. <http://xml.apache.org/cocoon/faqs.html> To unsubscribe, e-mail: <[EMAIL PROTECTED]> For additional commands, e-mail: <[EMAIL PROTECTED]>