RE: [INTERFACES] JDBC next() method
От | Peter Mount |
---|---|
Тема | RE: [INTERFACES] JDBC next() method |
Дата | |
Msg-id | A9DCBD548069D211924000C00D001C441D8D3C@exchange.maidstone.gov.uk обсуждение исходный текст |
Список | pgsql-interfaces |
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(queryResult.next()) {} loop, so your interpretation is correct. Peter -- Peter T Mount, IT Section petermount@it.maidstone.gov.uk 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@pobox.com] Sent: Wednesday, April 14, 1999 1:57 PM To: 'pgsql-interfaces@hub.org' Subject: [INTERFACES] JDBC next() method 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 по дате отправления: