pg.ddx.io pgsql-jdbc@postgresql.org mailing list archive
help / color / mirror / Atom feedDatabaseMetada.supportOpenCursorsAcrossCommit() return wrong information.
2+ messages / 2 participants
[nested] [flat]
* DatabaseMetada.supportOpenCursorsAcrossCommit() return wrong information.
@ 2004-07-18 00:25 Dario V. Fassi <software@sistemat.com.ar>
0 siblings, 1 reply; 2+ messages in thread
From: Dario V. Fassi @ 2004-07-18 00:25 UTC (permalink / raw)
To: pgsql-jdbc
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.
Dario.
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: DatabaseMetada.supportOpenCursorsAcrossCommit() return
@ 2004-07-18 01:21 Oliver Jowett <oliver@opencloud.com>
parent: Dario V. Fassi <software@sistemat.com.ar>
0 siblings, 0 replies; 2+ messages in thread
From: Oliver Jowett @ 2004-07-18 01:21 UTC (permalink / raw)
To: Dario V. Fassi <software@sistemat.com.ar>; +Cc: 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
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2004-07-18 01:21 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2004-07-18 00:25 DatabaseMetada.supportOpenCursorsAcrossCommit() return wrong information. Dario V. Fassi <software@sistemat.com.ar>
2004-07-18 01:21 ` Re: DatabaseMetada.supportOpenCursorsAcrossCommit() return Oliver Jowett <oliver@opencloud.com>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox