Re: taking actions on rollback (PHP)

Поиск
Список
Период
Сортировка
От Martijn van Oosterhout
Тема Re: taking actions on rollback (PHP)
Дата
Msg-id 20080426211407.GD16188@svana.org
обсуждение исходный текст
Ответ на taking actions on rollback (PHP)  (Ivan Sergio Borgonovo <mail@webthatworks.it>)
Ответы Re: taking actions on rollback (PHP)
Список pgsql-general
On Sat, Apr 26, 2008 at 10:52:12PM +0200, Ivan Sergio Borgonovo wrote:
> How am I going to see if the transaction succeeded without checking
> what happens for each statement and getting the cleanup code execute?

You basically actually check for the errors in the earlier pg_query()
calls, since they will tell you. If you can't be bothered, you could
just do at the end of the transaction:

if( !pg_query("select 1") )
  pg_query("rollback');
  // DO CLEANUP HERE
}
else
{ pg_query("commit"); }

Have a nice day,
--
Martijn van Oosterhout   <kleptog@svana.org>   http://svana.org/kleptog/
> Please line up in a tree and maintain the heap invariant while
> boarding. Thank you for flying nlogn airlines.

Вложения

В списке pgsql-general по дате отправления:

Предыдущее
От: Ivan Sergio Borgonovo
Дата:
Сообщение: taking actions on rollback (PHP)
Следующее
От: Ivan Sergio Borgonovo
Дата:
Сообщение: Re: taking actions on rollback (PHP)