note 81022 added to function.PDO-beginTransaction
| From: | drm at melp dot nl | Date: | Mon, 11 Feb 2008 14:37:56 +0000 |
| Subject: | note 81022 added to function.PDO-beginTransaction | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-136040@lists.php.net to get a copy of this message | ||
In response to "Anonymous / 20-Dec-2007 03:04"
You could also extend the PDO class and hold a private flag to check if a transaction is already
started.
class MyPDO extends PDO {
protected $hasActiveTransaction = false;
function beginTransaction () {
if ( $this->hasActiveTransaction ) {
return false;
} else {
$this->hasActiveTransaction = parent::beginTransaction ();
return $this->hasActiveTransaction;
}
}
function commit () {
parent::commit ();
$this->hasActiveTransaction = false;
}
function rollback () {
parent::rollback ();
$this->hasActiveTransaction = false;
}
}
----
Server IP: 89.248.170.58
Probable Submitter: 213.84.233.128
----
Manual Page -- http://www.php.net/manual/en/function.PDO-beginTransaction.php
Edit -- https://master.php.net/note/edit/81022
Del: integrated -- https://master.php.net/note/delete/81022/integrated
Del: useless -- https://master.php.net/note/delete/81022/useless
Del: bad code -- https://master.php.net/note/delete/81022/bad+code
Del: spam -- https://master.php.net/note/delete/81022/spam
Del: non-english -- https://master.php.net/note/delete/81022/non-english
Del: in docs -- https://master.php.net/note/delete/81022/in+docs
Del: other reasons-- https://master.php.net/note/delete/81022
Reject -- https://master.php.net/note/reject/81022
Search -- https://master.php.net/manage/user-notes.php