Hello,
On the jOOQ user group, I have recently been made aware of an issue with
H2's TriggerAdapter behaviour (details can be seen here:
https://groups.google.com/d/msg/jooq-user/rGyc7dq9hRs/vpAzbxYjisMJ).
According to the TriggerAdapter Javadoc, the ResultSet arguments are in
fact "infinite", even if they hold only one record. It states:
"ResultSet.next does not need to be called (and calling it has no
effect; it will always return true)."
Taken from:
http://www.h2database.com/javadoc/org/h2/tools/TriggerAdapter.html#fire_Connection_ResultSet_ResultSet
The general contract of a ResultSet doesn't seem to allow such behaviour.
Specifically, the following is mentioned here:
"A ResultSet object maintains a cursor pointing to its current row of
data. Initially the cursor is positioned *before the first row*. The
next method
moves the cursor to the next row, and *because it returns **false when
there are no more rows in theResultSet object, it can be used in a while** loop
to iterate through the result set.*"
Taken from the first paragraphs of the JDBC Javadoc:
http://docs.oracle.com/javase/7/docs/api/java/sql/ResultSet.html
I understand that a previously initialised ResultSet seems convenient at
first. But when interfacing with other APIs that consume such a ResultSet,
"infinity" may cause weird effects. Wouldn't it be better to fix this
behaviour and to avoid "unexpected" convenience?
--
You received this message because you are subscribed to the Google Groups "H2
Database" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/h2-database?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.