dbTalk Databases Forums  

Re: [BUGS] Bug with deleteRow() for the ResultSet using PostgreSQL

mailing.database.pgsql-bugs mailing.database.pgsql-bugs


Discuss Re: [BUGS] Bug with deleteRow() for the ResultSet using PostgreSQL in the mailing.database.pgsql-bugs forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Kris Jurka
 
Posts: n/a

Default Re: [BUGS] Bug with deleteRow() for the ResultSet using PostgreSQL - 06-11-2004 , 06:21 PM








On Tue, 8 Jun 2004 ChristopherPesarchick (AT) westfieldgrp (DOT) com wrote:

Quote:
JDBC Driver : PostgreSQL 7.4 (Build 213)

I am having an issue with the driver when I do a deleteRow using a
ResultSet record. It skips records.
For example, if I have seven records and I select all of them in a
ResultSet, spin through each one and call deleteRow() the result is wrong.
The 1st, 3rd, 5th, and 7th records are deleted, but the others are not.

Behind the scenes the rows are stored in a Vector and there is an "int
current_row" pointer to the current row. The problem is that when a row
is deleted from the Vector, how should the current_row value be adjusted?
Currently nothing happens so current_row effectively points to the next
row so that when next() is called that row is skipped. Simply
decrementing current_row on a delete won't work because it introduces the
exact same problem except with previous(). When I looked at this problem
before I wanted to see if a cleaner solution presented itself than adding
a new variable like "boolean onDeletedRow" that would need to be
checked or reset in a significant number of places, but perhaps that's the
only way to go.

Kris Jurka

---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend


Reply With Quote
  #2  
Old   
Kris Jurka
 
Posts: n/a

Default Re: [BUGS] Bug with deleteRow() for the ResultSet using PostgreSQL - 06-16-2004 , 12:21 AM








On Fri, 11 Jun 2004, Kris Jurka wrote:

Quote:
On Tue, 8 Jun 2004 ChristopherPesarchick (AT) westfieldgrp (DOT) com wrote:

JDBC Driver : PostgreSQL 7.4 (Build 213)

I am having an issue with the driver when I do a deleteRow using a
ResultSet record. It skips records.
For example, if I have seven records and I select all of them in a
ResultSet, spin through each one and call deleteRow() the result is wrong.
The 1st, 3rd, 5th, and 7th records are deleted, but the others are not.


Behind the scenes the rows are stored in a Vector and there is an "int
current_row" pointer to the current row. The problem is that when a row
is deleted from the Vector, how should the current_row value be adjusted?
Currently nothing happens so current_row effectively points to the next
row so that when next() is called that row is skipped. Simply
decrementing current_row on a delete won't work because it introduces the
exact same problem except with previous(). When I looked at this problem
before I wanted to see if a cleaner solution presented itself than adding
a new variable like "boolean onDeletedRow" that would need to be
checked or reset in a significant number of places, but perhaps that's the
only way to go.

Doing some more reading it appears the ResultSet is supposed to be
positioned on the previous row, so I have made it do so in both the 7.4
and 7.4 cvs versions.

Kris Jurka


---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to majordomo (AT) postgresql (DOT) org


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.