Cursors and transactions

From: "Chris Smith" <cdsmith(at)twu(dot)net>
To: <pgsql-jdbc(at)postgresql(dot)org>
Subject: Cursors and transactions
Date: 2004-02-12 21:58:11
Message-ID: 01e801c3f1b3$4eec12c0$6f00000a@KYA
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

Hello,

I've poked in and out of here in the past, but now I'm tackling a pseudo-large
topic and am hoping that I'll ghet some help. Specifically, I want to port a
patch I wrote for the 7.3 JDBC drivers over to 7.4. The patch was to
incrementally send queries for PreparedStatement objects that use
setBinaryStream. It was a simple patch for 7.3, but is looking less so for
7.4.

Looking at 7.4, it looks like it would be much better to shoot for using the
extended query mechanism to do this, because the V3 wire protocol uses
byte-counted messages, but I won't know how many bytes are going to be in an
encoded bytea value until I'm done sending it. So, I've taken on the task of
converting the 7.4 JDBC drivers to use the extended query mechanism for at
least some (and possibly all) queries. It looks like the best way to
accomplish this is to have every Statement object contain a named parsed
statement in the V3 protocol; and every ResultSet contain a named portal.
This would then supplant (conditional on protocol version, of course) the
current code to accomplish similar goals, which seems to translate the
statement SQL itself to use EXECUTE and DECLARE CURSOR commands.

So, with that background and introduction down, here's my first two questions.

1. I'd like to get *something* working fairly quickly. Is it possible to
force the 7.4 server to communicate using the V2 protocol, so I can quickly
port my old patch and use it while I work on something more ambitious?

2. Starting on the more ambitious approach, I notice a comment to the effect
of "we only support one cursor per connection". Is that a fundamental
limitation of PostgreSQL, or something specific to the drivers? If the
former, it apparently doesn't apply to named portals in the V3 protocol
extended query mechanism... is that correct?

--
www.designacourse.com
The Easiest Way to Train Anyone... Anywhere.

Chris Smith - Lead Software Developer/Technical Trainer
MindIQ Corporation

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Oliver Jowett 2004-02-12 23:24:12 Re: Cursors and transactions
Previous Message Xavier Maysonnave 2004-02-12 21:45:47 Re: License