JDBC next() method

From: Jon Barnett <jbarnett(at)pobox(dot)com>
To: "'pgsql-interfaces(at)hub(dot)org'" <pgsql-interfaces(at)hub(dot)org>
Subject: JDBC next() method
Date: 1999-04-14 12:57:13
Message-ID: 01BE86CA.23683420.jbarnett@pobox.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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.

Responses

Browse pgsql-interfaces by date

  From Date Subject
Next Message Peter Mount 1999-04-14 13:18:23 RE: [INTERFACES] JDBC next() method
Previous Message Dave Page 1999-04-14 07:38:38 RE: Bug Reports