Skip site navigation (1) Skip section navigation (2)

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: (view raw, whole thread or download thread mbox)
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();
   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.



pgsql-jdbc by date

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

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group