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

From: Kris Jurka <books(at)ejurka(dot)com>
To: ChristopherPesarchick(at)westfieldgrp(dot)com
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: Bug with deleteRow() for the ResultSet using PostgreSQL
Date: 2004-06-16 05:12:25
Message-ID: Pine.BSO.4.56.0406160011340.30439@leary.csoft.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Fri, 11 Jun 2004, Kris Jurka wrote:

> 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

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Kris Jurka 2004-06-16 05:14:29 Re: BUG #1121: JDBC AbstractJdbc2ResultSet.deleteRow()
Previous Message Bruce Momjian 2004-06-16 03:48:00 Re: BUG #1167: POSIX getpwuid_r 4arg vs 5arg issue