note 75431 added to function.pdo-rollback

From: Date: Wed, 30 May 2007 02:07:35 +0000
Subject: note 75431 added to function.pdo-rollback
Groups: php.notes 
Request: Send a blank email to php-notes+get-127005@lists.php.net to get a copy of this message
Since "It is an error to call this method if no transaction is active", it could be useful (even if not indispensable) to have a method which returns true if a transaction is active. try { $dbh->beginTransaction(); ... } catch (PDOException $e) { if ($dbh->isTransactionActive()) // this function does NOT exist $dbh->rollBack(); ... } In the meanwhile, I'm using this code: ... } catch (PDOException $e) { try { $dbh->rollBack(); } catch (Exception $e2) {} ... } It's not so chic, but it works fine. ---- Server IP: 213.92.11.19 Probable Submitter: 151.41.67.127 ---- Manual Page -- http://www.php.net/manual/en/function.pdo-rollback.php Edit -- https://master.php.net/note/edit/75431 Del: integrated -- https://master.php.net/note/delete/75431/integrated Del: useless -- https://master.php.net/note/delete/75431/useless Del: bad code -- https://master.php.net/note/delete/75431/bad+code Del: spam -- https://master.php.net/note/delete/75431/spam Del: non-english -- https://master.php.net/note/delete/75431/non-english Del: in docs -- https://master.php.net/note/delete/75431/in+docs Del: other reasons-- https://master.php.net/note/delete/75431 Reject -- https://master.php.net/note/reject/75431 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#127005) next »