JDBC next() method - Mailing list pgsql-interfaces

From Jon Barnett
Subject JDBC next() method
Date
Msg-id 01BE86CA.23683420.jbarnett@pobox.com
Whole thread Raw
Responses Re: [INTERFACES] JDBC next() method
List pgsql-interfaces
I'm not quite sure about the correct operation of the JDBC next() method.

Suppose I have the following code:

queryResult = dbStatement.executeQuery("select max(history_id) from history");
if (queryResult.next())
    nextID = queryResult.getLong(1) + 1;
else
    nextID = 0;

With the postgresql JDBC driver, the minimum value for nextID is 1, even if the
history table is empty.  I had expected that an empty result set would be
returned if the history table is empty (0 rows returned for the select), and
queryResult.next() would be false.  Is this an incorrect interpretation on my
part?

Thanks,

JonB.

pgsql-interfaces by date:

Previous
From: Dave Page
Date:
Subject: RE: Bug Reports
Next
From: Peter Mount
Date:
Subject: RE: [INTERFACES] JDBC next() method