Skip site navigation (1) Skip section navigation (2)

bug in the jdbc driver for postgress 7.0 (ResultSet.java)

From: Travis Bauer <trbauer(at)indiana(dot)edu>
To: pgsql-bugs(at)postgresql(dot)org
Subject: bug in the jdbc driver for postgress 7.0 (ResultSet.java)
Date: 2000-05-25 02:50:20
Message-ID: Pine.GSO.4.21.0005242140250.1142-100000@mantaray.cs.indiana.edu (view raw or flat)
Thread:
Lists: pgsql-bugs
I think I've found a bug in how the jdbc driver (JDBC2) numbers the rows
in a result set.  According to Sun's documentation for the ResultSet
interface, the rows in a result set should be numbered starting with
1.  However, the ResultSet.java's first() routine set's current_row to
0. The odd thing is that beforeFirst() also sets current_row to 0, it
just does not load this_row.  The bug manifests itself as such:

given ResultSet rs containing two rows:

rs.last();
System.out.println("Last id is: "+rs.getRow());
rs.first();
System.out.println("First id is: "+rs.getRow());

produces the output:

Last id is: 1
First id is: 0

I think the easiest fix would be to change getRow() so that it returns
current_row+1, and change beforeFirst so that it sets current_row to
-1.  I'm not sure what other changes need to be made, but since the JDBC
driver does not allow one to refer directly to row numbers, I can't think
of any other changes offhand.

Or am I all wet and this is not a bug?  Please respond to me directly, as
I'm not a member of this list.

----------------------------------------------------------------
Travis Bauer | CS Grad Student | IU |www.cs.indiana.edu/~trbauer
----------------------------------------------------------------


Responses

pgsql-bugs by date

Next:From: Bruce MomjianDate: 2000-05-25 03:34:04
Subject: Re: bug in the jdbc driver for postgress 7.0 (ResultSet.java)
Previous:From: The Hermit HackerDate: 2000-05-24 19:07:04
Subject: Re: Just checking on a few bugs...

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group