pg.ddx.io  pgsql-interfaces@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Jon Barnett <jbarnett@pobox.com>
To: 'pgsql-interfaces@hub.org' <pgsql-interfaces@hub.org>
Subject: JDBC next() method
Date: Wed, 14 Apr 1999 22:57:13 +1000
Message-ID: <01BE86CA.23683420.jbarnett@pobox.com> (raw)

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.



view thread (13+ messages)  latest in thread

Message-ID: <01BE86CA.23683420.jbarnett@pobox.com>
Permalink:  ../01BE86CA.23683420.jbarnett@pobox.com/
Also on:    postgresql.org/message-id/01BE86CA.23683420.jbarnett@pobox.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-interfaces@postgresql.org
  Cc: jbarnett@pobox.com, pgsql-interfaces@hub.org
  Subject: Re: JDBC next() method
  In-Reply-To: <01BE86CA.23683420.jbarnett@pobox.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox