Re: Prepare Statement
| От | Jie Liang |
|---|---|
| Тема | Re: Prepare Statement |
| Дата | |
| Msg-id | E7E213858379814A9AE48CA6754F5ECB034519CB@mail01.stbernard.com обсуждение исходный текст |
| Ответ на | Prepare Statement ("Jie Liang" <jie@stbernard.com>) |
| Ответы |
Re: Prepare Statement
|
| Список | pgsql-jdbc |
Nope, it will get same error msg:
Myfunction(text) does net exist
Jie Liang
-----Original Message-----
From: Oliver Jowett [mailto:oliver@opencloud.com]
Sent: Friday, June 18, 2004 4:07 PM
To: Jie Liang
Cc: Kris Jurka; pgsql-jdbc@postgresql.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
В списке pgsql-jdbc по дате отправления: