db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mamta Satoor <ma...@Remulak.Net>
Subject Position of the ResultSet after updateRow?
Date Tue, 04 Jan 2005 15:46:52 GMT
Hi,

Some of you might recall the discussion on where the ResultSet should be
positioned after deleteRow and the conclusion that it will be placed right
before the next row in the ResultSet.

My question is about ResultSet position after updateRow. An updateRow
can make the row not qualify for the original select query.
eg
rs = stmt.executeQuery("SELECT c32 FROM t3 where c32 > 2 FOR UPDATE");
rs.next();
//test1
rs.updateInt(1,4);//notice that c32 is still >2 and hence this updated row still qualifies
to stay in the ResultSet
rs.updateRow();
rs.next();
//test2
rs.updateInt(1,1);//notice that c32 is not >2 anymore and does not qualify to stay in the
ResultSet
rs.updateRow();

For the test2, after updateRow, I am thinking of positioning the ResultSet right before
the next row since the row does not qualify anymore. But for test1, since the row still
qualifies to stay in the ResultSet, should I keep the ResultSet on this updated row or
should I position it before the next row. The advantage of positioning it before the
next row for both test1 and test2 is that it will be consistent and will be easier for the
user. Note that I didn't find JDBC spec cover these 2 scenarios.

Also, the above discussion is for Forward Only Updatable ResultSet.

thanks,
Mamta


Mime
View raw message