taking actions on rollback (PHP)

From: Ivan Sergio Borgonovo <mail(at)webthatworks(dot)it>
To: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: taking actions on rollback (PHP)
Date: 2008-04-26 20:52:12
Message-ID: 20080426225212.5755ac66@dawn.webthatworks.it
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I've a set of statements...

pg_query('begin;');

pg_query('do stuff');
pg_query('do other stuff');

if(!pg_query('commit;')) {
pg_query('rollback;');
// DO SOME CLEANUP HERE
}

if something goes wrong the statement actually get rolled back... but
the pg_query('commit;') statement always succede so the cleanup never
get executed.
How am I going to see if the transaction succeeded without checking
what happens for each statement and getting the cleanup code execute?

thanks

--
Ivan Sergio Borgonovo
http://www.webthatworks.it

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Martijn van Oosterhout 2008-04-26 21:14:07 Re: taking actions on rollback (PHP)
Previous Message Tom Lane 2008-04-26 20:02:56 Re: Regular expression