Re: IN clauses via setObject(Collection) [Was: Re: Prepare

From: Paul Thomas <paul(at)tmsl(dot)demon(dot)co(dot)uk>
To: "pgsql-jdbc (at) postgresql (dot) org" <pgsql-jdbc(at)postgresql(dot)org>
Subject: Re: IN clauses via setObject(Collection) [Was: Re: Prepare
Date: 2003-07-21 18:24:43
Message-ID: 20030721192443.A4376@bacon
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc


On 21/07/2003 17:38 Darin Ohashi wrote:
>
> At this point I think I need to re-ask my original question. Is the
> ability to
> pass a set throught a ? in a JDBC PreparedStatement something that should
> be
> do-able at all, regardless of if you can find an inoffensive way through
> the
> JDBC interface?

It certainly should _not_ be doable using setObject(). It's clear to me
(look at the first sentance in the javadoc for setObject(int, Object))
that it must treat Object as a single object and produce a single value
which is matched against its paramter marker.
>
> I believe that a JBDC PreparedStatement is meant to be just a front end
> for an
> SQL PREPARE statement. If it is not valid to send a set in an SQL
> PREPARE
> statement (which I have not yet been given a definative answer for)
> should there
> be away to pass it through a JDBC PreparedStatement? What happens when
> you want
> JDBC PreparedStatements to be PREPARE'd statements? Will this ability be
> dropped at that time or will some messy hack be defined to continue to
> support
> this behaviour?

My understanding is that currently you need to tell the statement to use
server-side prepares otherwise the driver executes it as a non-prepared
statement, in which case the back-end is un-troubled by exploitation of
this bug. If server-side prepares are used, I would expect (haven't tried
it) that, based on the documentation of the EXECUTE statement, an error
would be raised because of the mismatch in the number of arguments.
Somehow, I don't think you'll persuade the core developers to bastardize
the back-end to make it work with a bastardized, non-complient botch in
the JDBC driver.

--
Paul Thomas
+------------------------------+---------------------------------------------+
| Thomas Micro Systems Limited | Software Solutions for the Smaller
Business |
| Computer Consultants |
http://www.thomas-micro-systems-ltd.co.uk |
+------------------------------+---------------------------------------------+

In response to

Browse pgsql-jdbc by date

  From Date Subject
Next Message David Wall 2003-07-21 18:41:05 Re: Detecting 'socket errors' - closing the Connection object
Previous Message scott.marlowe 2003-07-21 18:10:33 Re: Number of function parameter