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.