Commit 45d41f1c authored by romanb's avatar romanb

merged fix for #873 from 0.10

parent 223daae2
...@@ -222,7 +222,7 @@ class Doctrine_Transaction extends Doctrine_Connection_Module ...@@ -222,7 +222,7 @@ class Doctrine_Transaction extends Doctrine_Connection_Module
if ( ! $event->skipOperation) { if ( ! $event->skipOperation) {
try { try {
$this->conn->getDbh()->beginTransaction(); $this->_doBeginTransaction();
} catch (Exception $e) { } catch (Exception $e) {
throw new Doctrine_Transaction_Exception($e->getMessage()); throw new Doctrine_Transaction_Exception($e->getMessage());
} }
...@@ -292,7 +292,7 @@ class Doctrine_Transaction extends Doctrine_Connection_Module ...@@ -292,7 +292,7 @@ class Doctrine_Transaction extends Doctrine_Connection_Module
$listener->preTransactionCommit($event); $listener->preTransactionCommit($event);
if ( ! $event->skipOperation) { if ( ! $event->skipOperation) {
$this->conn->getDbh()->commit(); $this->_doCommit();
} }
$listener->postTransactionCommit($event); $listener->postTransactionCommit($event);
} }
...@@ -355,7 +355,7 @@ class Doctrine_Transaction extends Doctrine_Connection_Module ...@@ -355,7 +355,7 @@ class Doctrine_Transaction extends Doctrine_Connection_Module
$this->_nestingLevel = 0; $this->_nestingLevel = 0;
$this->_internalNestingLevel = 0; $this->_internalNestingLevel = 0;
try { try {
$this->conn->getDbh()->rollback(); $this->_doRollback();
} catch (Exception $e) { } catch (Exception $e) {
throw new Doctrine_Transaction_Exception($e->getMessage()); throw new Doctrine_Transaction_Exception($e->getMessage());
} }
...@@ -401,6 +401,30 @@ class Doctrine_Transaction extends Doctrine_Connection_Module ...@@ -401,6 +401,30 @@ class Doctrine_Transaction extends Doctrine_Connection_Module
{ {
throw new Doctrine_Transaction_Exception('Savepoints not supported by this driver.'); 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 * removeSavePoints
......
...@@ -65,4 +65,28 @@ class Doctrine_Transaction_Mssql extends Doctrine_Transaction ...@@ -65,4 +65,28 @@ class Doctrine_Transaction_Mssql extends Doctrine_Transaction
$this->conn->execute($query); $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');
}
} }
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment