pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Oliver Jowett <oliver@opencloud.com>
To: Dave Cramer <pg@fastcrypt.com>
Cc: List <pgsql-jdbc@postgresql.org>
Subject: Re: patch for passing the cts
Date: Wed, 15 Jun 2005 11:21:38 +1200
Message-ID: <42AF6682.6000405@opencloud.com> (raw)
In-Reply-To: <2BC23AE7-6381-41BA-AE89-CC81D1C932A7@fastcrypt.com>
References: <2BC23AE7-6381-41BA-AE89-CC81D1C932A7@fastcrypt.com>

Dave Cramer wrote:
> Well the good news is that the driver and the backend will pass the  cts
> with this patch.
> 
> Rather than commit this as is, I'd like to discuss the patch as it is.
> 
> I'm really not happy with the handling of IN/OUT parameters in the 
> query executor, however deferring parsing doesn't seem to be an  option
> either.

I don't think your approach works, though; consider this (untested) example:

 CallableStatement cs = conn.prepareCall("{call f(?*4,?)}");
 cs.setInt(1,42);
 cs.registerOutParameter(2,Types.INTEGER);

The query gets parsed into these fragments:

 0:"select * from f("
 1:"*4,"
 2:") as result"

As I read your code, that's going to discard fragment 1 blindly in the
query executor, resulting in this query:

  "select * from f($1) as result"

which is wrong.

The logic that decides to remove OUT placeholders needs to be aware of
the rest of the {call} structure (mainly, comma separation of
parameters) to do it correctly, and I really don't think that the
QueryExecutor implementations are the right place for that..

-O



view thread (7+ messages)  latest in thread

Message-ID: <42AF6682.6000405@opencloud.com>
Permalink:  ../42AF6682.6000405@opencloud.com/
Also on:    postgresql.org/message-id/42AF6682.6000405@opencloud.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-jdbc@postgresql.org
  Cc: oliver@opencloud.com, pg@fastcrypt.com
  Subject: Re: patch for passing the cts
  In-Reply-To: <42AF6682.6000405@opencloud.com>
  References: <2BC23AE7-6381-41BA-AE89-CC81D1C932A7@fastcrypt.com> <42AF6682.6000405@opencloud.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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