From: Dima Tkach <dmitry@openratings.com>
To: Oliver Jowett <oliver@opencloud.com>
Cc: Kim Ho <kho@redhat.com>
Cc: Fernando Nasser <fnasser@redhat.com>
Cc: Barry Lind <blind@xythos.com>
Cc: pgsql-jdbc-list <pgsql-jdbc@postgresql.org>
Cc: Dave Cramer <Dave@micro-automation.net>
Subject: Re: Prepared Statements
Date: Sun, 20 Jul 2003 12:39:45 -0400
Message-ID: <3F1AC5D1.4010307@openratings.com> (raw)
In-Reply-To: <20030719012555.GA20158@opencloud.com>
References: <3F1801C5.9030104@openratings.com>
<3F181A81.70208@xythos.com>
<3F18259C.6090503@redhat.com>
<1058548037.19658.159.camel@topanga.toronto.redhat.com>
<3F183004.4010508@openratings.com>
<3F1830F6.3020203@openratings.com>
<1058550328.19657.168.camel@topanga.toronto.redhat.com>
<3F183423.9030900@openratings.com>
<1058551402.20165.177.camel@topanga.toronto.redhat.com>
<3F183AE0.8060204@openratings.com>
<20030719012555.GA20158@opencloud.com>
The problem with this (and other similar suggestions in this thread -
like use PGArray etc.) is that the app will not even compile with
postgres jdbc classes.
The whole point in using jdbc interfaces is to abstract the application
from the particular driver implementation.
The way it works currently, it is entirely possible either (text
representation of arrays vary between vendors, as do ways you can use to
specify sets as parameters), but, at least, you don't have to maintain
the whole special piece of code, that can only compile when postgres
driver is available.
Dima
Oliver Jowett wrote:
>On Fri, Jul 18, 2003 at 02:22:24PM -0400, Dmitry Tkach wrote:
>
>
>
>>What I am concerned about is the "in" thing -
>>
>>select * from sometable where x in ?;
>>setObject (1, "(1,2,3,4,5)");
>>
>>that works just fine right now, and will be irreperably broken by this
>>patch...
>>
>>
>
>How about:
>
> + create an org.postgresql.InSet class that wraps an Object[] array and java.sql.Types value
> + use setObject(N, new InSet(myArray, Types.INTEGER));
>
>The Javadoc for PreparedStatement.setObject() says:
>
> Note that this method may be used to pass datatabase- specific abstract data
> types, by using a driver-specific Java type.
>
>so presumably this is the right way to do it. setObject() would handle an
>InSet by individually escaping the components of the array it wraps as if
>they had been passed to setObject() and turning them into an IN-like clause.
>
>For arrays we just need to fix setArray() so that it does the same sort of
>thing as described above, using the java.sql.Array methods to get the
>component objects. And maybe provide a simple implementation of Array that
>wraps a Java array (users can always provide their own, anyway).
>
>Any thoughts? I can try to sort out patches, but I'm a bit short on time
>right now so no promises.
>
>-O
>
>
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: dmitry@openratings.com, oliver@opencloud.com, kho@redhat.com, fnasser@redhat.com, blind@xythos.com, Dave@micro-automation.net
Subject: Re: Prepared Statements
In-Reply-To: <3F1AC5D1.4010307@openratings.com>
References: <3F1801C5.9030104@openratings.com> <3F181A81.70208@xythos.com> <3F18259C.6090503@redhat.com> <1058548037.19658.159.camel@topanga.toronto.redhat.com> <3F183004.4010508@openratings.com> <3F1830F6.3020203@openratings.com> <1058550328.19657.168.camel@topanga.toronto.redhat.com> <3F183423.9030900@openratings.com> <1058551402.20165.177.camel@topanga.toronto.redhat.com> <3F183AE0.8060204@openratings.com> <20030719012555.GA20158@opencloud.com> <3F1AC5D1.4010307@openratings.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