Re: IN clauses via setObject(Collection) [Was: Re: Prepare - Mailing list pgsql-jdbc

From Paul Thomas
Subject Re: IN clauses via setObject(Collection) [Was: Re: Prepare
Date
Msg-id 20030721192443.A4376@bacon
Whole thread Raw
In response to Re: IN clauses via setObject(Collection) [Was: Re: Prepare  (Darin Ohashi <DOhashi@maplesoft.com>)
List 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   |
+------------------------------+---------------------------------------------+

pgsql-jdbc by date:

Previous
From: "scott.marlowe"
Date:
Subject: Re: Number of function parameter
Next
From: "David Wall"
Date:
Subject: Re: Detecting 'socket errors' - closing the Connection object