From: Jason Tesser <jasontesser@gmail.com>
To: Kris Jurka <books@ejurka.com>
Cc: pgsql-jdbc <pgsql-jdbc@postgresql.org>
Subject: Re: Correct way to send a composite type to Postgres
Date: Thu, 18 Feb 2010 06:48:30 -0500
Message-ID: <98bbb46a1002180348r7e3bb0e8m9aa906ff41b9e4ad@mail.gmail.com> (raw)
In-Reply-To: <alpine.BSO.2.00.1002180011520.30823@leary.csoft.net>
References: <98bbb46a1002160313m25967352s8b59e480e778d5c4@mail.gmail.com>
<alpine.BSO.2.00.1002180011520.30823@leary.csoft.net>
yea that is what i did. I was wondering though if there are gotchas here
for escaping? Are here are Utilities in the driver I can use to make sure
the data is escaped ok? any thoughts here.
I mean basically i did
public String getValue() {
return "(" + person.getId() + "," + person.getFirstName() + "," +
person.getLastName() + "," + person.getMiddleName() + ")";
}
On Thu, Feb 18, 2010 at 12:17 AM, Kris Jurka <books@ejurka.com> wrote:
>
>
> On Tue, 16 Feb 2010, Jason Tesser wrote:
>
> I have a composite type that is an IN parameter for a Stored Function.
>> How
>> do I construct the type in Java?
>>
>> I know in Postgres I can do row(....) I was hoping for something a little
>> more Javaish instead to having to build that String.
>>
>> Can I extend PGObject to accomplish this?
>>
>
> Currently there isn't a great way to do this with the PG JDBC driver. You
> can encapsulate the ugliness with PGObject, but you can't avoid it. If you
> have a type that extends PGObject all you need to do is override the
> toString method to format the data as the server expects it.
>
> Kris Jurka
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-jdbc@postgresql.org
Cc: jasontesser@gmail.com, books@ejurka.com
Subject: Re: Correct way to send a composite type to Postgres
In-Reply-To: <98bbb46a1002180348r7e3bb0e8m9aa906ff41b9e4ad@mail.gmail.com>
References: <98bbb46a1002160313m25967352s8b59e480e778d5c4@mail.gmail.com> <alpine.BSO.2.00.1002180011520.30823@leary.csoft.net> <98bbb46a1002180348r7e3bb0e8m9aa906ff41b9e4ad@mail.gmail.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox