2006-11-13 23:09:14 +03:00
|
|
|
<?php
|
|
|
|
/*
|
|
|
|
* $Id$
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
|
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
|
|
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
|
|
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
|
|
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
|
|
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
|
|
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
|
|
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
|
|
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
|
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
|
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
*
|
|
|
|
* This software consists of voluntary contributions made by many individuals
|
|
|
|
* and is licensed under the LGPL. For more information, see
|
2008-01-23 01:52:53 +03:00
|
|
|
* <http://www.phpdoctrine.org>.
|
2006-11-13 23:09:14 +03:00
|
|
|
*/
|
2008-05-30 16:09:24 +04:00
|
|
|
|
|
|
|
#namespace Doctrine::DBAL::Transactions;
|
|
|
|
|
2006-11-13 23:09:14 +03:00
|
|
|
/**
|
2007-05-16 02:37:04 +04:00
|
|
|
* Handles transaction savepoint and isolation abstraction
|
2006-11-13 23:09:14 +03:00
|
|
|
*
|
|
|
|
* @author Konsta Vesterinen <kvesteri@cc.hut.fi>
|
2008-08-01 22:46:14 +04:00
|
|
|
* @author Lukas Smith <smith@pooteeweet.org> (PEAR MDB2 library)
|
|
|
|
* @author Roman Borschel <roman@code-factory.org>
|
2006-11-13 23:09:14 +03:00
|
|
|
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
|
2008-02-22 21:11:35 +03:00
|
|
|
* @link www.phpdoctrine.org
|
2006-11-13 23:09:14 +03:00
|
|
|
* @since 1.0
|
|
|
|
* @version $Revision$
|
|
|
|
*/
|
2006-12-29 17:40:47 +03:00
|
|
|
class Doctrine_Transaction extends Doctrine_Connection_Module
|
|
|
|
{
|
2006-11-13 23:09:14 +03:00
|
|
|
/**
|
2008-02-15 01:41:06 +03:00
|
|
|
* A transaction is in sleep state when it is not active.
|
2006-11-13 23:09:14 +03:00
|
|
|
*/
|
2006-11-14 21:21:36 +03:00
|
|
|
const STATE_SLEEP = 0;
|
2007-10-21 10:23:59 +04:00
|
|
|
|
2006-11-13 23:09:14 +03:00
|
|
|
/**
|
2008-02-15 01:41:06 +03:00
|
|
|
* A transaction is in active state when it is active.
|
2006-11-13 23:09:14 +03:00
|
|
|
*/
|
2006-11-14 21:21:36 +03:00
|
|
|
const STATE_ACTIVE = 1;
|
2007-10-21 10:23:59 +04:00
|
|
|
|
2006-11-13 23:09:14 +03:00
|
|
|
/**
|
2008-02-15 01:41:06 +03:00
|
|
|
* A transaction is in busy state when it is active and has a nesting level > 1.
|
2006-11-13 23:09:14 +03:00
|
|
|
*/
|
2006-11-14 21:21:36 +03:00
|
|
|
const STATE_BUSY = 2;
|
2007-10-21 10:23:59 +04:00
|
|
|
|
2006-11-13 23:09:14 +03:00
|
|
|
/**
|
2007-12-12 18:52:12 +03:00
|
|
|
* @var integer $_nestingLevel The current nesting level of this transaction.
|
|
|
|
* A nesting level of 0 means there is currently no active
|
|
|
|
* transaction.
|
2006-11-13 23:09:14 +03:00
|
|
|
*/
|
2007-12-12 18:52:12 +03:00
|
|
|
protected $_nestingLevel = 0;
|
2007-10-21 10:23:59 +04:00
|
|
|
|
2006-12-01 02:51:44 +03:00
|
|
|
/**
|
|
|
|
* @var array $savepoints an array containing all savepoints
|
|
|
|
*/
|
2008-02-15 01:41:06 +03:00
|
|
|
protected $savePoints = array();
|
2007-10-21 10:23:59 +04:00
|
|
|
|
2007-05-23 00:47:27 +04:00
|
|
|
/**
|
2008-08-01 22:46:14 +04:00
|
|
|
* Returns the state of this transaction module.
|
2006-11-13 23:09:14 +03:00
|
|
|
*
|
|
|
|
* @see Doctrine_Connection_Transaction::STATE_* constants
|
|
|
|
* @return integer the connection state
|
|
|
|
*/
|
2006-12-29 17:40:47 +03:00
|
|
|
public function getState()
|
|
|
|
{
|
2007-12-12 18:52:12 +03:00
|
|
|
switch ($this->_nestingLevel) {
|
2006-12-30 00:30:37 +03:00
|
|
|
case 0:
|
2008-08-01 22:46:14 +04:00
|
|
|
return self::STATE_SLEEP;
|
2006-12-30 00:30:37 +03:00
|
|
|
break;
|
|
|
|
case 1:
|
2008-08-01 22:46:14 +04:00
|
|
|
return self::STATE_ACTIVE;
|
2006-12-30 00:30:37 +03:00
|
|
|
break;
|
|
|
|
default:
|
2008-08-01 22:46:14 +04:00
|
|
|
return self::STATE_BUSY;
|
2006-11-13 23:09:14 +03:00
|
|
|
}
|
|
|
|
}
|
2007-06-26 15:19:25 +04:00
|
|
|
|
2006-11-30 00:09:02 +03:00
|
|
|
/**
|
2008-08-01 22:46:14 +04:00
|
|
|
* Gets the current transaction nesting level.
|
2006-11-13 23:09:14 +03:00
|
|
|
*
|
|
|
|
* @return integer
|
2008-03-17 16:26:34 +03:00
|
|
|
* @todo Name suggestion: getNestingLevel(). $transaction->getTransactionLevel() looks odd.
|
2006-11-13 23:09:14 +03:00
|
|
|
*/
|
2006-12-29 17:40:47 +03:00
|
|
|
public function getTransactionLevel()
|
|
|
|
{
|
2007-12-12 18:52:12 +03:00
|
|
|
return $this->_nestingLevel;
|
2007-06-25 22:47:36 +04:00
|
|
|
}
|
2007-10-21 10:23:59 +04:00
|
|
|
|
2006-11-13 23:09:14 +03:00
|
|
|
/**
|
|
|
|
* Start a transaction or set a savepoint.
|
|
|
|
*
|
2006-12-29 17:01:31 +03:00
|
|
|
* if trying to set a savepoint and there is no active transaction
|
2006-12-01 02:51:44 +03:00
|
|
|
* a new transaction is being started
|
|
|
|
*
|
2007-12-12 18:52:12 +03:00
|
|
|
* This method should only be used by userland-code to initiate transactions.
|
|
|
|
* To initiate a transaction from inside Doctrine use {@link beginInternalTransaction()}.
|
|
|
|
*
|
2006-11-14 21:21:36 +03:00
|
|
|
* Listeners: onPreTransactionBegin, onTransactionBegin
|
|
|
|
*
|
2006-11-13 23:09:14 +03:00
|
|
|
* @param string $savepoint name of a savepoint to set
|
2007-06-12 03:25:46 +04:00
|
|
|
* @throws Doctrine_Transaction_Exception if the transaction fails at database level
|
2006-11-13 23:09:14 +03:00
|
|
|
* @return integer current transaction nesting level
|
|
|
|
*/
|
2008-08-01 22:46:14 +04:00
|
|
|
public function begin($savepoint = null)
|
2006-12-29 17:40:47 +03:00
|
|
|
{
|
2007-06-12 03:25:46 +04:00
|
|
|
$this->conn->connect();
|
2008-08-01 22:46:14 +04:00
|
|
|
//$listener = $this->conn->getAttribute(Doctrine::ATTR_LISTENER);
|
2006-11-30 00:09:02 +03:00
|
|
|
|
2007-06-25 22:47:36 +04:00
|
|
|
if ( ! is_null($savepoint)) {
|
2006-12-01 02:51:44 +03:00
|
|
|
$this->savePoints[] = $savepoint;
|
2008-08-01 22:46:14 +04:00
|
|
|
//$event = new Doctrine_Event($this, Doctrine_Event::SAVEPOINT_CREATE);
|
|
|
|
//$listener->preSavepointCreate($event);
|
|
|
|
//if ( ! $event->skipOperation) {
|
2007-06-25 21:51:19 +04:00
|
|
|
$this->createSavePoint($savepoint);
|
2008-08-01 22:46:14 +04:00
|
|
|
//}
|
|
|
|
//$listener->postSavepointCreate($event);
|
2006-11-13 23:09:14 +03:00
|
|
|
} else {
|
2007-12-12 18:52:12 +03:00
|
|
|
if ($this->_nestingLevel == 0) {
|
2008-08-01 22:46:14 +04:00
|
|
|
//$event = new Doctrine_Event($this, Doctrine_Event::TX_BEGIN);
|
|
|
|
//$listener->preTransactionBegin($event);
|
2006-11-30 00:09:02 +03:00
|
|
|
|
2008-08-01 22:46:14 +04:00
|
|
|
//if ( ! $event->skipOperation) {
|
2007-06-25 21:51:19 +04:00
|
|
|
try {
|
2008-03-20 18:17:01 +03:00
|
|
|
$this->_doBeginTransaction();
|
2007-12-12 18:52:12 +03:00
|
|
|
} catch (Exception $e) {
|
2007-06-25 21:51:19 +04:00
|
|
|
throw new Doctrine_Transaction_Exception($e->getMessage());
|
|
|
|
}
|
2008-08-01 22:46:14 +04:00
|
|
|
//}
|
|
|
|
//$listener->postTransactionBegin($event);
|
2006-11-30 00:09:02 +03:00
|
|
|
}
|
2006-11-13 23:09:14 +03:00
|
|
|
}
|
|
|
|
|
2007-12-12 18:52:12 +03:00
|
|
|
$level = ++$this->_nestingLevel;
|
2006-11-13 23:09:14 +03:00
|
|
|
|
|
|
|
return $level;
|
|
|
|
}
|
2007-10-21 10:23:59 +04:00
|
|
|
|
2006-11-13 23:09:14 +03:00
|
|
|
/**
|
2008-08-01 22:46:14 +04:00
|
|
|
* Commits the database changes done during a transaction that is in
|
2006-11-13 23:09:14 +03:00
|
|
|
* progress or release a savepoint. This function may only be called when
|
2006-12-29 17:01:31 +03:00
|
|
|
* auto-committing is disabled, otherwise it will fail.
|
2006-11-14 21:21:36 +03:00
|
|
|
*
|
2007-06-25 14:08:03 +04:00
|
|
|
* Listeners: preTransactionCommit, postTransactionCommit
|
2006-11-13 23:09:14 +03:00
|
|
|
*
|
|
|
|
* @param string $savepoint name of a savepoint to release
|
2007-06-12 03:25:46 +04:00
|
|
|
* @throws Doctrine_Transaction_Exception if the transaction fails at database level
|
2006-11-13 23:09:14 +03:00
|
|
|
* @throws Doctrine_Validator_Exception if the transaction fails due to record validations
|
2006-12-01 02:51:44 +03:00
|
|
|
* @return boolean false if commit couldn't be performed, true otherwise
|
2006-11-13 23:09:14 +03:00
|
|
|
*/
|
2006-12-29 17:40:47 +03:00
|
|
|
public function commit($savepoint = null)
|
|
|
|
{
|
2007-12-12 18:52:12 +03:00
|
|
|
if ($this->_nestingLevel == 0) {
|
|
|
|
throw new Doctrine_Transaction_Exception("Commit failed. There is no active transaction.");
|
2007-06-12 03:25:46 +04:00
|
|
|
}
|
2007-12-12 18:52:12 +03:00
|
|
|
|
|
|
|
$this->conn->connect();
|
2006-12-01 02:51:44 +03:00
|
|
|
|
2008-08-01 22:46:14 +04:00
|
|
|
//$listener = $this->conn->getAttribute(Doctrine::ATTR_LISTENER);
|
2007-06-25 21:51:19 +04:00
|
|
|
|
2006-11-13 23:09:14 +03:00
|
|
|
if ( ! is_null($savepoint)) {
|
2007-12-12 18:52:12 +03:00
|
|
|
$this->_nestingLevel -= $this->removeSavePoints($savepoint);
|
2008-08-01 22:46:14 +04:00
|
|
|
//$event = new Doctrine_Event($this, Doctrine_Event::SAVEPOINT_COMMIT);
|
|
|
|
//$listener->preSavepointCommit($event);
|
|
|
|
//if ( ! $event->skipOperation) {
|
2007-06-25 21:51:19 +04:00
|
|
|
$this->releaseSavePoint($savepoint);
|
2008-08-01 22:46:14 +04:00
|
|
|
//}
|
|
|
|
//$listener->postSavepointCommit($event);
|
|
|
|
} else {
|
|
|
|
if ($this->_nestingLevel == 1) {
|
|
|
|
//$event = new Doctrine_Event($this, Doctrine_Event::TX_COMMIT);
|
|
|
|
//$listener->preTransactionCommit($event);
|
|
|
|
//if ( ! $event->skipOperation) {
|
|
|
|
$this->_doCommit();
|
|
|
|
//}
|
|
|
|
//$listener->postTransactionCommit($event);
|
2006-11-13 23:09:14 +03:00
|
|
|
}
|
2007-06-25 22:47:36 +04:00
|
|
|
|
2007-12-12 18:52:12 +03:00
|
|
|
if ($this->_nestingLevel > 0) {
|
|
|
|
$this->_nestingLevel--;
|
2008-08-01 22:46:14 +04:00
|
|
|
}
|
2006-11-13 23:09:14 +03:00
|
|
|
}
|
2006-12-29 17:01:31 +03:00
|
|
|
|
2006-12-01 02:51:44 +03:00
|
|
|
return true;
|
2006-11-13 23:09:14 +03:00
|
|
|
}
|
2007-06-26 15:19:25 +04:00
|
|
|
|
2006-11-13 23:09:14 +03:00
|
|
|
/**
|
|
|
|
* Cancel any database changes done during a transaction or since a specific
|
|
|
|
* savepoint that is in progress. This function may only be called when
|
|
|
|
* auto-committing is disabled, otherwise it will fail. Therefore, a new
|
|
|
|
* transaction is implicitly started after canceling the pending changes.
|
|
|
|
*
|
2007-06-12 03:25:46 +04:00
|
|
|
* this method can be listened with onPreTransactionRollback and onTransactionRollback
|
2006-11-13 23:09:14 +03:00
|
|
|
* eventlistener methods
|
|
|
|
*
|
2007-06-12 03:25:46 +04:00
|
|
|
* @param string $savepoint name of a savepoint to rollback to
|
|
|
|
* @throws Doctrine_Transaction_Exception if the rollback operation fails at database level
|
2006-12-01 02:51:44 +03:00
|
|
|
* @return boolean false if rollback couldn't be performed, true otherwise
|
2006-11-13 23:09:14 +03:00
|
|
|
*/
|
2006-12-29 17:40:47 +03:00
|
|
|
public function rollback($savepoint = null)
|
|
|
|
{
|
2007-12-12 18:52:12 +03:00
|
|
|
if ($this->_nestingLevel == 0) {
|
|
|
|
throw new Doctrine_Transaction_Exception("Rollback failed. There is no active transaction.");
|
|
|
|
}
|
2007-11-18 19:06:37 +03:00
|
|
|
|
2007-12-12 18:52:12 +03:00
|
|
|
$this->conn->connect();
|
|
|
|
|
2008-08-01 22:46:14 +04:00
|
|
|
if ($this->_nestingLevel > 1) {
|
2007-12-12 18:52:12 +03:00
|
|
|
$this->_nestingLevel--;
|
2006-12-01 02:51:44 +03:00
|
|
|
return false;
|
2007-06-12 03:25:46 +04:00
|
|
|
}
|
2006-11-13 23:09:14 +03:00
|
|
|
|
2007-06-25 21:51:19 +04:00
|
|
|
$listener = $this->conn->getAttribute(Doctrine::ATTR_LISTENER);
|
|
|
|
|
2006-12-29 17:01:31 +03:00
|
|
|
if ( ! is_null($savepoint)) {
|
2007-12-12 18:52:12 +03:00
|
|
|
$this->_nestingLevel -= $this->removeSavePoints($savepoint);
|
2008-08-01 22:46:14 +04:00
|
|
|
//$event = new Doctrine_Event($this, Doctrine_Event::SAVEPOINT_ROLLBACK);
|
|
|
|
//$listener->preSavepointRollback($event);
|
|
|
|
//if ( ! $event->skipOperation) {
|
2007-06-25 21:51:19 +04:00
|
|
|
$this->rollbackSavePoint($savepoint);
|
2008-08-01 22:46:14 +04:00
|
|
|
//}
|
|
|
|
//$listener->postSavepointRollback($event);
|
2006-11-13 23:09:14 +03:00
|
|
|
} else {
|
2008-08-01 22:46:14 +04:00
|
|
|
//$event = new Doctrine_Event($this, Doctrine_Event::TX_ROLLBACK);
|
|
|
|
//$listener->preTransactionRollback($event);
|
|
|
|
//if ( ! $event->skipOperation) {
|
2007-12-12 18:52:12 +03:00
|
|
|
$this->_nestingLevel = 0;
|
2007-06-25 14:08:03 +04:00
|
|
|
try {
|
2008-03-20 18:17:01 +03:00
|
|
|
$this->_doRollback();
|
2007-06-25 14:08:03 +04:00
|
|
|
} catch (Exception $e) {
|
|
|
|
throw new Doctrine_Transaction_Exception($e->getMessage());
|
|
|
|
}
|
2008-08-01 22:46:14 +04:00
|
|
|
//}
|
|
|
|
//$listener->postTransactionRollback($event);
|
2006-11-13 23:09:14 +03:00
|
|
|
}
|
2006-12-29 17:01:31 +03:00
|
|
|
|
2006-12-01 02:51:44 +03:00
|
|
|
return true;
|
2006-11-13 23:09:14 +03:00
|
|
|
}
|
2007-06-26 15:19:25 +04:00
|
|
|
|
2006-11-13 23:09:14 +03:00
|
|
|
/**
|
2008-08-01 22:46:14 +04:00
|
|
|
* Creates a new savepoint.
|
2006-11-13 23:09:14 +03:00
|
|
|
*
|
|
|
|
* @param string $savepoint name of a savepoint to create
|
|
|
|
* @return void
|
|
|
|
*/
|
2006-12-29 17:40:47 +03:00
|
|
|
protected function createSavePoint($savepoint)
|
|
|
|
{
|
2006-11-13 23:09:14 +03:00
|
|
|
throw new Doctrine_Transaction_Exception('Savepoints not supported by this driver.');
|
|
|
|
}
|
2007-06-26 15:19:25 +04:00
|
|
|
|
2006-11-13 23:09:14 +03:00
|
|
|
/**
|
2008-08-01 22:46:14 +04:00
|
|
|
* Releases given savepoint.
|
2006-11-13 23:09:14 +03:00
|
|
|
*
|
|
|
|
* @param string $savepoint name of a savepoint to release
|
|
|
|
* @return void
|
|
|
|
*/
|
2006-12-29 17:40:47 +03:00
|
|
|
protected function releaseSavePoint($savepoint)
|
|
|
|
{
|
2006-11-13 23:09:14 +03:00
|
|
|
throw new Doctrine_Transaction_Exception('Savepoints not supported by this driver.');
|
|
|
|
}
|
2007-06-26 15:19:25 +04:00
|
|
|
|
2006-11-13 23:09:14 +03:00
|
|
|
/**
|
2008-08-01 22:46:14 +04:00
|
|
|
* Performs a rollback to a specified savepoint.
|
2006-11-13 23:09:14 +03:00
|
|
|
*
|
|
|
|
* @param string $savepoint name of a savepoint to rollback to
|
|
|
|
* @return void
|
|
|
|
*/
|
2006-12-29 17:40:47 +03:00
|
|
|
protected function rollbackSavePoint($savepoint)
|
|
|
|
{
|
2006-11-13 23:09:14 +03:00
|
|
|
throw new Doctrine_Transaction_Exception('Savepoints not supported by this driver.');
|
|
|
|
}
|
2008-03-20 18:17:01 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Performs the rollback.
|
|
|
|
*/
|
|
|
|
protected function _doRollback()
|
|
|
|
{
|
|
|
|
$this->conn->getDbh()->rollback();
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Performs the commit.
|
|
|
|
*/
|
|
|
|
protected function _doCommit()
|
|
|
|
{
|
|
|
|
$this->conn->getDbh()->commit();
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Begins a database transaction.
|
|
|
|
*/
|
|
|
|
protected function _doBeginTransaction()
|
|
|
|
{
|
|
|
|
$this->conn->getDbh()->beginTransaction();
|
|
|
|
}
|
2007-06-26 15:19:25 +04:00
|
|
|
|
2006-12-01 02:51:44 +03:00
|
|
|
/**
|
|
|
|
* removes a savepoint from the internal savePoints array of this transaction object
|
|
|
|
* and all its children savepoints
|
|
|
|
*
|
|
|
|
* @param sring $savepoint name of the savepoint to remove
|
2007-06-25 22:47:36 +04:00
|
|
|
* @return integer removed savepoints
|
2006-12-01 02:51:44 +03:00
|
|
|
*/
|
2006-12-29 17:40:47 +03:00
|
|
|
private function removeSavePoints($savepoint)
|
|
|
|
{
|
2007-09-03 18:57:18 +04:00
|
|
|
$this->savePoints = array_values($this->savePoints);
|
2006-12-01 02:51:44 +03:00
|
|
|
|
2007-06-25 22:47:36 +04:00
|
|
|
$found = false;
|
|
|
|
$i = 0;
|
2006-12-01 02:51:44 +03:00
|
|
|
|
2007-06-25 22:47:36 +04:00
|
|
|
foreach ($this->savePoints as $key => $sp) {
|
|
|
|
if ( ! $found) {
|
|
|
|
if ($sp === $savepoint) {
|
|
|
|
$found = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if ($found) {
|
|
|
|
$i++;
|
|
|
|
unset($this->savePoints[$key]);
|
|
|
|
}
|
2006-12-01 02:51:44 +03:00
|
|
|
}
|
2007-06-25 22:47:36 +04:00
|
|
|
|
|
|
|
return $i;
|
2006-12-01 02:51:44 +03:00
|
|
|
}
|
2007-06-26 17:08:58 +04:00
|
|
|
|
2006-11-14 21:21:36 +03:00
|
|
|
/**
|
|
|
|
* Set the transacton isolation level.
|
|
|
|
* (implemented by the connection drivers)
|
|
|
|
*
|
|
|
|
* example:
|
|
|
|
*
|
|
|
|
* <code>
|
|
|
|
* $tx->setIsolation('READ UNCOMMITTED');
|
|
|
|
* </code>
|
|
|
|
*
|
|
|
|
* @param string standard isolation level
|
|
|
|
* READ UNCOMMITTED (allows dirty reads)
|
|
|
|
* READ COMMITTED (prevents dirty reads)
|
|
|
|
* REPEATABLE READ (prevents nonrepeatable reads)
|
|
|
|
* SERIALIZABLE (prevents phantom reads)
|
|
|
|
*
|
2006-11-24 01:54:10 +03:00
|
|
|
* @throws Doctrine_Transaction_Exception if the feature is not supported by the driver
|
2006-11-14 21:21:36 +03:00
|
|
|
* @throws PDOException if something fails at the PDO level
|
|
|
|
* @return void
|
|
|
|
*/
|
2006-12-29 17:40:47 +03:00
|
|
|
public function setIsolation($isolation)
|
|
|
|
{
|
2006-11-24 01:54:10 +03:00
|
|
|
throw new Doctrine_Transaction_Exception('Transaction isolation levels not supported by this driver.');
|
2006-11-14 21:21:36 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2008-08-01 22:46:14 +04:00
|
|
|
* Fetches the current session transaction isolation level.
|
2006-11-14 21:21:36 +03:00
|
|
|
*
|
2006-12-29 17:01:31 +03:00
|
|
|
* note: some drivers may support setting the transaction isolation level
|
2006-11-14 21:21:36 +03:00
|
|
|
* but not fetching it
|
2006-11-24 01:54:10 +03:00
|
|
|
*
|
|
|
|
* @throws Doctrine_Transaction_Exception if the feature is not supported by the driver
|
2006-11-14 21:21:36 +03:00
|
|
|
* @throws PDOException if something fails at the PDO level
|
|
|
|
* @return string returns the current session transaction isolation level
|
|
|
|
*/
|
2006-12-29 17:40:47 +03:00
|
|
|
public function getIsolation()
|
|
|
|
{
|
2006-11-24 01:54:10 +03:00
|
|
|
throw new Doctrine_Transaction_Exception('Fetching transaction isolation level not supported by this driver.');
|
2008-08-01 22:46:14 +04:00
|
|
|
}
|
2007-10-29 22:50:16 +03:00
|
|
|
}
|