1
0
mirror of synced 2025-03-23 08:23:51 +03:00

merged fix for #873 from 0.10

This commit is contained in:
romanb 2008-03-20 15:17:01 +00:00
parent 223daae2ec
commit 45d41f1c9b
2 changed files with 51 additions and 3 deletions

View File

@ -222,7 +222,7 @@ class Doctrine_Transaction extends Doctrine_Connection_Module
if ( ! $event->skipOperation) {
try {
$this->conn->getDbh()->beginTransaction();
$this->_doBeginTransaction();
} catch (Exception $e) {
throw new Doctrine_Transaction_Exception($e->getMessage());
}
@ -292,7 +292,7 @@ class Doctrine_Transaction extends Doctrine_Connection_Module
$listener->preTransactionCommit($event);
if ( ! $event->skipOperation) {
$this->conn->getDbh()->commit();
$this->_doCommit();
}
$listener->postTransactionCommit($event);
}
@ -355,7 +355,7 @@ class Doctrine_Transaction extends Doctrine_Connection_Module
$this->_nestingLevel = 0;
$this->_internalNestingLevel = 0;
try {
$this->conn->getDbh()->rollback();
$this->_doRollback();
} catch (Exception $e) {
throw new Doctrine_Transaction_Exception($e->getMessage());
}
@ -401,6 +401,30 @@ class Doctrine_Transaction extends Doctrine_Connection_Module
{
throw new Doctrine_Transaction_Exception('Savepoints not supported by this driver.');
}
/**
* 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();
}
/**
* removeSavePoints

View File

@ -65,4 +65,28 @@ class Doctrine_Transaction_Mssql extends Doctrine_Transaction
$this->conn->execute($query);
}
/**
* Performs the rollback.
*/
protected function _doRollback()
{
$this->conn->getDbh()->exec('ROLLBACK TRANSACTION');
}
/**
* Performs the commit.
*/
protected function _doCommit()
{
$this->conn->getDbh()->exec('COMMIT TRANSACTION');
}
/**
* Begins a database transaction.
*/
protected function _doBeginTransaction()
{
$this->conn->getDbh()->exec('BEGIN TRANSACTION');
}
}