Subject | Re: [Firebird-Architect] Re: Update WHERE CURRENT OF vs. ResultSet.isLast() |
---|---|
Author | Nickolay Samofatov |
Post date | 2003-07-07T22:42:34Z |
Hello, Roman,
fully compatible with updatable cursors unless we change Firebird
engine internals in one way or another (scrollable cursors or cursor
bookmarks).
(Answering Jim's post) You are right, my idea breaks the spec a
little (just checked, sorry), but it can behave well under "dumb"
usage pattern:
----
ResultSet rs = ....;
while (!rs.isLast()) {
rs.next();
.... Do something with cursor here
}
----
>> I'm not going to presume to offer advice on how Firebird shouldThis seems to be better solution. isLast() usage is not going to be
>> handle the problem. Netfrastructure, however, handles the
>> ResultSet.isLast() method in approximately to following manner:
>>
>> throw new SQLException ("Not Yet Implemented")
>> ...
>> My reasoning is that positional updates have been part of SQL from
>> day 0 and are semantically significant while ResultSet.isLast() is
>> recent, semantically unnecessary, and absurdly expensive to
>> implement.
> Interesting enough, Sun provides this information in Javadocs for
> ResultSet.isLast(): "Note: Calling the method isLast may be expensive
> because the JDBC driver might need to fetch ahead one row in order to
> determine whether the current row is the last row in the result set."
> So, they are perfectly aware that some servers would require
> additional fetch. However I did not find anything about the cursor
> position in this case. Also, funny enough, but they do not include
> isLast() in JDBC CTS suite (I just checked it). I would say, this
> fully confirms your words "is recent, semantically unnecessary, and
> absurdly expensive to implement" and makes your implementation
> perfectly compatible with JDBC specification! :)
> Most likely JayBird will provide different fetchers for
> ResultSet.CONCUR_READ_ONLY and ResultSet.CONCUR_UPDATABLE. In
> updatable case isLast() will be implemented like in Netfrastructure.
fully compatible with updatable cursors unless we change Firebird
engine internals in one way or another (scrollable cursors or cursor
bookmarks).
(Answering Jim's post) You are right, my idea breaks the spec a
little (just checked, sorry), but it can behave well under "dumb"
usage pattern:
----
ResultSet rs = ....;
while (!rs.isLast()) {
rs.next();
.... Do something with cursor here
}
----
> Roman RokytskyyNickolay Samofatov