X-Original-To: pgsql-jdbc-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 275D7D1B211 for ; Sat, 17 Jul 2004 22:21:52 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 43685-06 for ; Sun, 18 Jul 2004 01:21:52 +0000 (GMT) Received: from yass.opencloud.co.nz (yass.opencloud.co.nz [203.79.85.162]) by svr1.postgresql.org (Postfix) with ESMTP id F1468D1B1CE for ; Sat, 17 Jul 2004 22:21:48 -0300 (ADT) Received: from 203-79-104-60.cable.paradise.net.nz ([203.79.104.60] helo=opencloud.com) by yass.opencloud.co.nz with asmtp (Exim 3.35 #1 (Debian)) id 1Bm0N8-0001M0-00; Sun, 18 Jul 2004 13:21:46 +1200 Message-ID: <40F9D0A4.2050401@opencloud.com> Date: Sun, 18 Jul 2004 13:21:40 +1200 From: Oliver Jowett User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.6b) Gecko/20031205 Thunderbird/0.4 X-Accept-Language: en-us, en MIME-Version: 1.0 To: "Dario V. Fassi" Cc: "pgsql-jdbc@postgresql.org" Subject: Re: DatabaseMetada.supportOpenCursorsAcrossCommit() return References: <40F9C374.1040106@sistemat.com.ar> In-Reply-To: <40F9C374.1040106@sistemat.com.ar> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.1 tagged_above=0.0 required=5.0 tests=RCVD_IN_SORBS X-Spam-Level: X-Archive-Number: 200407/224 X-Sequence-Number: 10608 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