note 82034 added to function.PDO-rollBack
| From: | brian at diamondsea dot com | Date: | Tue, 25 Mar 2008 15:19:39 +0000 |
| Subject: | note 82034 added to function.PDO-rollBack | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-137560@lists.php.net to get a copy of this message | ||
Here is a way of testing that your transaction has started when using MySQL's InnoDB tables.
It will fail if you are using MySQL's MyISAM tables, which do not support transactions but will
also not return an error when using them.
<?
// Begin the transaction
$dbh->beginTransaction();
// To verify that a transaction has started, try to create an (illegal for InnoDB) nested
transaction.
// If it works, the first transaction did not start correctly or is unsupported (such as on
MyISAM tables)
try {
$dbh->beginTransaction();
die('Cancelling, Transaction was not properly started');
} catch (PDOException $e) {
print "Transaction is running (because trying another one failed)\n";
}
?>
----
Server IP: 217.160.250.20
Probable Submitter: 63.217.142.210
----
Manual Page -- http://www.php.net/manual/en/function.PDO-rollBack.php
Edit -- https://master.php.net/note/edit/82034
Del: integrated -- https://master.php.net/note/delete/82034/integrated
Del: useless -- https://master.php.net/note/delete/82034/useless
Del: bad code -- https://master.php.net/note/delete/82034/bad+code
Del: spam -- https://master.php.net/note/delete/82034/spam
Del: non-english -- https://master.php.net/note/delete/82034/non-english
Del: in docs -- https://master.php.net/note/delete/82034/in+docs
Del: other reasons-- https://master.php.net/note/delete/82034
Reject -- https://master.php.net/note/reject/82034
Search -- https://master.php.net/manage/user-notes.php