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

RE: [INTERFACES] JDBC next() method

From: Peter Mount <petermount(at)it(dot)maidstone(dot)gov(dot)uk>
To: jbarnett(at)pobox(dot)com, "'Peter Mount'" <petermount(at)it(dot)maidstone(dot)gov(dot)uk>, "'pgsql-interfaces(at)hub(dot)org'" <pgsql-interfaces(at)hub(dot)org>
Subject: RE: [INTERFACES] JDBC next() method
Date: 1999-04-14 14:51:39
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-interfaces
That's correct (we use that syntax in the driver's source ourselves).

wasNull() is only valid after a getxxx() call, but only for the last


Peter T Mount, IT Section
Anything I write here are my own views, and cannot be taken as the
official words of Maidstone Borough Council

-----Original Message-----
From: Jon Barnett [mailto:jbarnett(at)pobox(dot)com]
Sent: Wednesday, April 14, 1999 3:37 PM
To: 'Peter Mount'; 'pgsql-interfaces(at)hub(dot)org'
Subject: RE: [INTERFACES] JDBC next() method

On Wednesday, 14 April 1999 23:18, Peter Mount 
[SMTP:petermount(at)it(dot)maidstone(dot)gov(dot)uk] wrote:
> This looks ok.
> queryResult is null if there was an error in the query, so you should
> check for that.
> However, normal use would have the result parsed within a
> while( {} loop, so your interpretation is correct.

I don't think the query should give an error - as the query is at least 
syntactically correct.  Certainly, if I check for a queryResult == null,
condition doesn't occur for an empty table.

I just had a quick browse on some old JDBC notes and it looks like the
solution is:

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

Note:  queryResult.wasNull() only works immediately after calling a



pgsql-interfaces by date

Next:From: Loic Mahe'Date: 1999-04-14 15:52:24
Subject: Pb. when compiling jdbc (postgresql-6.4.2)
Previous:From: Jon BarnettDate: 1999-04-14 14:37:03
Subject: RE: [INTERFACES] JDBC next() method

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