stored function, multiple queries, best practices - Mailing list pgsql-jdbc

From Ash Grove
Subject stored function, multiple queries, best practices
Date
Msg-id 20060414124834.63095.qmail@web52501.mail.yahoo.com
Whole thread Raw
Responses Re: stored function, multiple queries, best practices  (Oliver Jowett <oliver@opencloud.com>)
List pgsql-jdbc
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

pgsql-jdbc by date:

Previous
From: Kris Jurka
Date:
Subject: Re: Possible regression: setNull() usage changed from 7.4 to
Next
From: Oliver Jowett
Date:
Subject: Re: stored function, multiple queries, best practices