JDBC next() method

Поиск
Список
Период
Сортировка
От Jon Barnett
Тема JDBC next() method
Дата
Msg-id 01BE86CA.23683420.jbarnett@pobox.com
обсуждение исходный текст
Ответы Re: [INTERFACES] JDBC next() method
Список 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 по дате отправления:

Предыдущее
От: Dave Page
Дата:
Сообщение: RE: Bug Reports
Следующее
От: Peter Mount
Дата:
Сообщение: RE: [INTERFACES] JDBC next() method