patch: don't use cursors with scrollable resultsets

From: Oliver Jowett <oliver(at)opencloud(dot)com>
To: pgsql-jdbc(at)postgresql(dot)org
Subject: patch: don't use cursors with scrollable resultsets
Date: 2003-11-05 01:39:38
Message-ID: 20031105013936.GA31833@opencloud.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

The CVS driver breaks if you set a non-zero fetchsize on a scrollable
resultset (causing a cursor to be used), then try to use anything other than
next() on that resultset. Testcases & patch attached. Barry/Dave: the patch
is the same as the earlier one I sent to you, the testcases are new.

The patch is only a temporary fix: it disables use of cursors entirely if
we're going to be generating a scrollable resultset. There's no reason we
can't use cursors in this case, but supporting that correctly requires more
extensive changes.

The patch also changes the default resultset type for JDBC2/3 Statements to
ResultSet.TYPE_FORWARD_ONLY. This is the implied default for JDBC1 already
(as JDBC1 does not have scrollable resultsets) and is the default required
according to the JDBC3 javadoc; however the existing driver defaults to
ResultSet.TYPE_SCROLL_INSENSITIVE because "everyone is used to using [it]"
(or so says the comment). This change means that code that sets a nonzero
fetchsize but does not explicitly specify a resultset type will continue to
use cursors behind the scenes.

Anyone have a view on which default is desirable?

-O

Attachment Content-Type Size
006_scrollable_resultsets.txt text/plain 8.3 KB

Browse pgsql-jdbc by date

  From Date Subject
Next Message Oliver Jowett 2003-11-05 02:11:57 Re: Allow specifying server/port for the test suite
Previous Message Dave Cramer 2003-11-04 18:05:22 Re: automatic sequence number?