Skip site navigation (1) Skip section navigation (2)

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 (view raw or flat)
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

pgsql-general by date

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

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group