Re: Prepare Statement

From: "Jie Liang" <jie(at)stbernard(dot)com>
To: "Oliver Jowett" <oliver(at)opencloud(dot)com>
Cc: "Kris Jurka" <books(at)ejurka(dot)com>, <pgsql-jdbc(at)postgresql(dot)org>
Subject: Re: Prepare Statement
Date: 2004-06-19 01:30:45
Message-ID: E7E213858379814A9AE48CA6754F5ECB034519CB@mail01.stbernard.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

Nope, it will get same error msg:
Myfunction(text) does net exist

Jie Liang

-----Original Message-----
From: Oliver Jowett [mailto:oliver(at)opencloud(dot)com]
Sent: Friday, June 18, 2004 4:07 PM
To: Jie Liang
Cc: Kris Jurka; pgsql-jdbc(at)postgresql(dot)org
Subject: Re: [JDBC] Prepare Statement

Jie Liang wrote:
> So, I think that PreparedStatement should have a way at least case a
> String to an Array or a way to create a Array, because of
> conn.prepareStatement("SELECT myfunction('{1,2,3}')") is NOT very
> useful.

One way that might work in the current driver is to use PGobject, which
lets you specify the underlying typename to use:

stmt = conn.preparedStatement("SELECT myfunction(?)");
org.postgresql.util.PGobject obj = new PGobject();
obj.setValue("'{1,2,3}'");
obj.setType("int[]");
stmt.setObject(1, obj);

Untested, but in theory this should work even with
setUseServerPrepare(true) in effect.

Also, if you search the archives, quite some time ago (a year?) I posted

a patch that implemented setArray() better, so that you could pass your
own Array implementation to it and have things work correctly. It's out
of date, but might give you a starting point.

-O

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Oliver Jowett 2004-06-19 01:39:14 Re: Prepare Statement
Previous Message Oliver Jowett 2004-06-19 01:00:05 Re: proposal for CallableStatements to handle multiple out