PHP 8.5.0 RC4 available for testing

Voting

: six minus zero?
(Example: nine)

The Note You're Voting On

drm at melp dot nl
17 years ago
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;
}

}

<< Back to user notes page

To Top