From: Ash Grove <ash_grv7@yahoo.com>
To: pgsql-jdbc@postgresql.org
Subject: stored function, multiple queries, best practices
Date: Fri, 14 Apr 2006 05:48:34 -0700 (PDT)
Message-ID: <20060414124834.63095.qmail@web52501.mail.yahoo.com> (raw)
Hello,
I'd like to learn how other people approach this kind
of situation:
Say you want to do an insert on three tables and all
of your data is coming into the db from your
application. You do the first insert and a primary key
is generated. You grab that primary key and insert it
(along with some other data) into the two other
tables. Finally, you return the primary key to the
application. If something goes wrong, you want to
everything to rollback.
I currently do this by building a delimited string in
the application containing all data to be inserted and
then sending it, via callablestatement, to a stored
function. The function parses the string, does the
inserts and returns the primary key via a registered
out parameter.
Are there glaring errors with this approach? How would
you do this?
Thanks in advance,
Ash
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
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: ash_grv7@yahoo.com
Subject: Re: stored function, multiple queries, best practices
In-Reply-To: <20060414124834.63095.qmail@web52501.mail.yahoo.com>
References: <20060414124834.63095.qmail@web52501.mail.yahoo.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