Re: DatabaseMetada.supportOpenCursorsAcrossCommit() return

Поиск
Список
Период
Сортировка
От Oliver Jowett
Тема Re: DatabaseMetada.supportOpenCursorsAcrossCommit() return
Дата
Msg-id 40F9D0A4.2050401@opencloud.com
обсуждение исходный текст
Ответ на DatabaseMetada.supportOpenCursorsAcrossCommit() return wrong information.  ("Dario V. Fassi" <software@sistemat.com.ar>)
Список pgsql-jdbc
Dario V. Fassi wrote:
> I believe that this methods return wrong information.:
>
> DatabaseMetada.supportOpenCursorsAcrossCommit()      return false /
> would return TRUE
> DatabaseMetada.supportOpenCursorsAcrossRollBack()    return false /
> would return TRUE
>
> Code like this was user to say that.
>
> rs = executeQuery( ... );
> while ( rs.next() ) {
>    con.rollback();
>    con.commit();
>    System.err.println(  n++ ) ;
> }
>
> Count all the rows in the result set.

The metadata is correct -- the code you suggest above will fail if the
driver decides to use a resultset backed by a cursor. If it doesn't
decide to use a cursor, it'll work, but you can't rely on that behaviour
for all queries.

The right way to support this is to use JDBC3's holdable resultsets and
make the driver use a WITH HOLD cursor in that case.

It occurs to me that we can support holdable resultsets already by
disabling use of cursors when they are in use (along the lines of what
we do for scrollable resultsets) but I'm not convinced that's the best
thing to do -- better to implement proper cursor support instead.

-O

В списке pgsql-jdbc по дате отправления:

Предыдущее
От: "Dario V. Fassi"
Дата:
Сообщение: DatabaseMetada.supportOpenCursorsAcrossCommit() return wrong information.
Следующее
От: "Andrew Lazarus"
Дата:
Сообщение: Re: [ADMIN] Migrate postgres databases from SQL_ASCII to UNICODE