Gili -- thank you for your input. it pushed me to run some more tests.
here's what I found:
the Railo code calls Statement.getMoreResult() with an
argument Statement.CLOSE_CURRENT_RESULT; when that method is called with
the argument it for some reason changes the UpdateCount and the loop never
reaches the break statement so it becomes an infinite loop.
when I commented out the arg to getMoreResults() the code was running
properly:
if( ( stat.getMoreResults( /* Statement.CLOSE_CURRENT_RESULT */ ) == false
) && ( uc == -1 ) )
break;
this code is running with many other DBMSs and the only issue that I'm
aware of is with H2; perhaps there's a bug in
JdbcStatement.getMoreResults( Statement.CLOSE_CURRENT_RESULT ) ?
Igal
On Tuesday, May 1, 2012 8:26:30 PM UTC-7, Gili wrote:
>
>
> I don't think that's what they mean. According to
> http://onjava.com/onjava/excerpt/javaentnut_2/index2.html section
> "Multiple Result Sets":
>
> It is possible to write a SQL statement that returns more than one
> ResultSet or update count (exact methods of doing so vary depending on
> the database). [...] To be sure you've processed all the results for a
> Statement, you need to check that getMoreResults( ) returns false and
> that getUpdateCount( ) returns -1.
>
> And actually if you look at the Javadoc for getMoreResults() it seems
> to back up their claim. It provides example code that shows them doing
> exactly what is mentioned above (waiting for getUpdateCount() to become
> -1). Notice that they imply invoking getUpdateCount() multiple times (once
> per result).
>
> Gili
>
> On 01/05/2012 11:08 PM, Igal wrote:
>
> I think that getUpdateCount()
> in org.h2.jdbc.JdbcStatement.getUpdateCount() is not working according to
> standards.
>
> *-----*
> according to docs at
> http://docs.oracle.com/javase/6/docs/api/java/sql/Statement.html#getUpdateCount()
>
> int getUpdateCount() throws SQLException :
>
> Retrieves the current result as an update count; if the result is a
> ResultSet object or there are no more results, -1 is returned. *This
> method should be called only once per result*.
>
> Returns: the current result as an update count; *-1 if* the current
> result is a ResultSet object or* there are no more results *
> *-----*
>
> it seems to me that the first time this method is called it should
> return the Update Count, but if it is called a second time it should return
> -1, i.e. line 222 should be changed to something like this:
>
> int result = updateCount;
> updateCount = -1; // for subsequent calls
> return result;
>
> I'm trying to use H2 from Railo (
> https://groups.google.com/forum/#!forum/railo) and am experiencing a
> problem reported at https://issues.jboss.org/browse/RAILO-1638
>
> thank you for your consideration,
>
>
> Igal
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "H2 Database" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/h2-database/-/hY30Mzoc3LEJ.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/h2-database?hl=en.
>
>
>
--
You received this message because you are subscribed to the Google Groups "H2
Database" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/h2-database/-/UlxPVOE1U98J.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/h2-database?hl=en.