Subject | deleteRow on updateable Resultsets |
---|---|
Author | Steffen Heil |
Post date | 2009-11-18T02:34:59Z |
Hi
I am trying to delete some records. This is my code:
Statement statement = connection.createStatement(
java.sql.ResultSet.TYPE_SCROLL_INSENSITIVE,
java.sql.ResultSet.CONCUR_UPDATABLE );
ResultSet data = statement.executeQuery( "select content_id,
\"SIZE\", deleted, id from http$media" );
while ( data.next() )
if ( data.getBoolean( 3 ) || ! ids.contains(
Integer.valueOf( data.getInt( 1 ) ) ) ) {
total += data.getInt( 2 );
data.deleteRow();
count ++ ;
}
data.close();
statement.close();
As I am the only user of the database and as the HashSet ids does not
change, I expected that loop to delete every obsolete records.
However I need to run it multiple times, it always deletes only a part.
I suspect that deleteRow aleady does next, but I did not expect this from
the specs.
What is the right behaviror?
How can I implement this db-independently?
Regards,
Steffen
[Non-text portions of this message have been removed]
I am trying to delete some records. This is my code:
Statement statement = connection.createStatement(
java.sql.ResultSet.TYPE_SCROLL_INSENSITIVE,
java.sql.ResultSet.CONCUR_UPDATABLE );
ResultSet data = statement.executeQuery( "select content_id,
\"SIZE\", deleted, id from http$media" );
while ( data.next() )
if ( data.getBoolean( 3 ) || ! ids.contains(
Integer.valueOf( data.getInt( 1 ) ) ) ) {
total += data.getInt( 2 );
data.deleteRow();
count ++ ;
}
data.close();
statement.close();
As I am the only user of the database and as the HashSet ids does not
change, I expected that loop to delete every obsolete records.
However I need to run it multiple times, it always deletes only a part.
I suspect that deleteRow aleady does next, but I did not expect this from
the specs.
What is the right behaviror?
How can I implement this db-independently?
Regards,
Steffen
[Non-text portions of this message have been removed]