Re: Prepared Statements

From: Oliver Jowett <oliver(at)opencloud(dot)com>
To: Aaron Mulder <ammulder(at)alumni(dot)princeton(dot)edu>
Cc: PostgreSQL JDBC <pgsql-jdbc(at)postgresql(dot)org>
Subject: Re: Prepared Statements
Date: 2003-07-19 06:06:24
Message-ID: 20030719060623.GA20479@opencloud.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

On Sat, Jul 19, 2003 at 03:03:20AM -0400, Aaron Mulder wrote:
> I have to agree that it would be better to provide a solution
> using API calls than a solutions that requires one to send SQL syntax
> into a ?.
>
> But why can't we kill both birds with an implementation of
> java.sql.Array? If you need to use an Array, you can use a PGArray that
> wraps an Object[]. If you want to do an in clause, do "where foo in (?)"
> or "where foo in ?" and then use ps.setArray() instead of setObject().
> Then we can make the docs explicit on this.

setArray() needs to generate "'{1,2,3}'" for an array field, but you want
"(1,2,3)" for an IN clause. Requiring the JDBC driver to parse the query to
distinguish the two cases seems awkward.

-O

In response to

Browse pgsql-jdbc by date

  From Date Subject
Next Message pginfo 2003-07-19 06:52:12 jdbc batch performance problem
Previous Message Oliver Jowett 2003-07-19 01:25:55 Re: Prepared Statements