Subject | Update WHERE CURRENT OF vs. ResultSet.isLast() |
---|---|
Author | Roman Rokytskyy |
Post date | 2003-07-07T21:11:37Z |
Hi All,
I've got a request about implementing Statement.setCursorName(String)
and using positioned updates. While implementing this stuff I
discovered that with positioned updates we cannot have
ResultSet.isLast() working.
Reason for this is that server does not tell us anything whether we
fetched the last record or not. This happens only during additional
fetch() (we get reply "sorry, no more records"). Till now we
prefetched one record, but this moves cursor position too. So, when
using positioned update we would update next records, not current.
Fixing this prefetching breaks ResultSet.isLast().
Usually people use while(rs.next()) {...} construct, so broken
rs.isLast() would not affect them. However if you use do {rs.next()}
while(!rs.isLast()), you will get endless loop.
So, the question now is: what do you prefer - positioned updates or
correct work of ResultSet.isLast()? Should I create a poll in the group?
Best regards,
Roman Rokytskyy
I've got a request about implementing Statement.setCursorName(String)
and using positioned updates. While implementing this stuff I
discovered that with positioned updates we cannot have
ResultSet.isLast() working.
Reason for this is that server does not tell us anything whether we
fetched the last record or not. This happens only during additional
fetch() (we get reply "sorry, no more records"). Till now we
prefetched one record, but this moves cursor position too. So, when
using positioned update we would update next records, not current.
Fixing this prefetching breaks ResultSet.isLast().
Usually people use while(rs.next()) {...} construct, so broken
rs.isLast() would not affect them. However if you use do {rs.next()}
while(!rs.isLast()), you will get endless loop.
So, the question now is: what do you prefer - positioned updates or
correct work of ResultSet.isLast()? Should I create a poll in the group?
Best regards,
Roman Rokytskyy