taking actions on rollback (PHP) - Mailing list pgsql-general

From Ivan Sergio Borgonovo
Subject taking actions on rollback (PHP)
Date
Msg-id 20080426225212.5755ac66@dawn.webthatworks.it
Whole thread Raw
Responses Re: taking actions on rollback (PHP)
List 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


pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: Regular expression
Next
From: Martijn van Oosterhout
Date:
Subject: Re: taking actions on rollback (PHP)