Re: getXXX throws SQLException while on insert row
От | Kris Jurka |
---|---|
Тема | Re: getXXX throws SQLException while on insert row |
Дата | |
Msg-id | Pine.BSO.4.64.0712010435440.12362@leary.csoft.net обсуждение исходный текст |
Ответ на | getXXX throws SQLException while on insert row (Prasanth Reddy <dbadmin@nqadmin.com>) |
Ответы |
Re: getXXX throws SQLException while on insert row
|
Список | pgsql-jdbc |
On Mon, 29 Oct 2007, Prasanth Reddy wrote: > Should the below code throw an SQLException? > > rs.moveToInsertRow(); > rs.updateInt("account_id", 1023); > rs.getInt("account_id"); - shouldn't this return 1023 rather than > throwing SQLException? > > Below is the exception: > org.postgresql.util.PSQLException: ResultSet not positioned properly, > perhaps you need to call next. It's not clear. Reading the JDBC spec it doesn't seem to say anything about fetching data from a partially updated ResultSet. Also note that this doesn't work as you might expect for an update of a regular ResultSet row. int i = rs.getInt(1); rs.updateInt(1, i+1); // here j will be == i, not i+1. int j = rs.getInt(1); We store the pending values in a separate area because it makes things like cancelRowUpdates or just navigating away from the updated row without issuing updateRow easy. While I can see the utility of being able to fetch the updated values, it would complicate the driver, so I'm not excited about it unless you can point to some documentation that says we should. Kris Jurka
В списке pgsql-jdbc по дате отправления: