From: | Kris Jurka <books(at)ejurka(dot)com> |
---|---|
To: | Jay Howard <jhoward(at)alumni(dot)utexas(dot)net> |
Cc: | pgsql-jdbc(at)postgresql(dot)org |
Subject: | Re: passing user defined data types to stored procedures |
Date: | 2008-11-15 17:25:31 |
Message-ID: | Pine.BSO.4.64.0811151215450.12622@leary.csoft.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-jdbc |
On Fri, 14 Nov 2008, Jay Howard wrote:
> Does the driver support passing UDTs as arguments to stored procs?
>
Sort of, but not in the standard fashion. SQLData is not
supported, but it is possible to do it using PGobject (a postgresql
specific extension). If you make your class Foo extend PGobject [1] and
make getType return the type name and getValue return the text
representation that the server expects it will work for sending data to
the server. To get objects of this type back from the server, you must
register them via PGConnection.addDataType [2].
Sample text representation of a complex type:
jurka=# create type mytype as (a int, b text, c date);
CREATE TYPE
jurka=# select '(3,"a,b",2008-11-20)'::mytype;
mytype
----------------------
(3,"a,b",2008-11-20)
(1 row)
Kris Jurka
[1] http://jdbc.postgresql.org/documentation/publicapi/org/postgresql/util/PGobject.html
[2] http://jdbc.postgresql.org/documentation/publicapi/org/postgresql/PGConnection.html#addDataType(java.lang.String,%20java.lang.Class)
From | Date | Subject | |
---|---|---|---|
Next Message | Jay Howard | 2008-11-15 17:43:00 | Re: passing user defined data types to stored procedures |
Previous Message | Jay Howard | 2008-11-14 17:37:14 | passing user defined data types to stored procedures |