Обсуждение: JDBC getRow returns 0 after first instead of 1
I think the JDBC driver has several bugs around ResultSet row numbering. According to the JDBC API docs[1] the getRow() method on ResultSet should return 1 for the first row. Currently it returns zero. i.e. if (rs.first()) int n = rs.getRow(); // n is now 0 instead of 1 The same problem exists with the absolute and related methods which need to be passed 0 to go to the first row but the API docs say it should be 1. If I'm wrong could someone please explain what I got wrong. PS, Where is the CVS archive for the sources and is there anon access? I could not find it on the postgresql.org site. [1] http://java.sun.com/j2se/1.3/docs/api/java/sql/ResultSet.html#getRow() -- Phil Davis - pmd@azad.demon.co.uk
I'll check. It should be returning 1 (as JDBC numbering always starts at 1). The Anon cvs should be documented on postgresql.org (although when I last checked, there was no link to it). Peter -- Peter Mount Enterprise Support Maidstone Borough Council Any views stated are my own, and not those of Maidstone Borough Council -----Original Message----- From: Phil Davis [mailto:pmd@azad.demon.co.uk] Sent: Monday, July 31, 2000 1:18 PM To: pgsql-interfaces@postgresql.org Subject: [INTERFACES] JDBC getRow returns 0 after first instead of 1 I think the JDBC driver has several bugs around ResultSet row numbering. According to the JDBC API docs[1] the getRow() method on ResultSet should return 1 for the first row. Currently it returns zero. i.e. if (rs.first()) int n = rs.getRow(); // n is now 0 instead of 1 The same problem exists with the absolute and related methods which need to be passed 0 to go to the first row but the API docs say it should be 1. If I'm wrong could someone please explain what I got wrong. PS, Where is the CVS archive for the sources and is there anon access? I could not find it on the postgresql.org site. [1] http://java.sun.com/j2se/1.3/docs/api/java/sql/ResultSet.html#getRow() -- Phil Davis - pmd@azad.demon.co.uk
What version of the driver are you using? I fixed some off by one errors and my fixes made it into the cvs after 7.0 Phil Davis wrote: > > I think the JDBC driver has several bugs around ResultSet row > numbering. According to the JDBC API docs[1] the getRow() method on > ResultSet should return 1 for the first row. Currently it returns zero. > > i.e. > if (rs.first()) > int n = rs.getRow(); // n is now 0 instead of 1 > > The same problem exists with the absolute and related methods which > need to be passed 0 to go to the first row but the API docs say it should > be 1. > > If I'm wrong could someone please explain what I got wrong. > > PS, > Where is the CVS archive for the sources and is there anon access? I could > not find it on the postgresql.org site. > > [1] http://java.sun.com/j2se/1.3/docs/api/java/sql/ResultSet.html#getRow() > > -- > Phil Davis - pmd@azad.demon.co.uk
On Mon, Jul 31, 2000 at 11:26:50AM -0400, Joseph Shraibman wrote: > What version of the driver are you using? I fixed some off by one > errors and my fixes made it into the cvs after 7.0 I am using jdbc6.5-1.2.jar but I downloaded the development snapshot.support from a mirror today (seemed to be dated 25 July ish) and it looks like it still has the bug since getRow() returns current_row and first() sets current_row to 0 but I have not upgraded to V7 backend yet so cannot test yet. Anyway I still have not found the CVS access info yet! -- Phil Davis - pmd@azad.demon.co.uk
Phil Davis <pmd@azad.demon.co.uk> writes: > Anyway I still have not found the CVS access info yet! It's in the on-line reference manual: http://www.postgresql.org/docs/postgres/cvs.htm At one time there was a link to this info from the "download" page, but I don't see one there now ... regards, tom lane