Commit 1b3e0d3b authored by Benjamin Eberlei's avatar Benjamin Eberlei

DBAL-55 - Final cleanups

parent 6abf6aaf
...@@ -803,7 +803,7 @@ class Connection implements DriverConnection ...@@ -803,7 +803,7 @@ class Connection implements DriverConnection
if ($this->_transactionNestingLevel == 1) { if ($this->_transactionNestingLevel == 1) {
$this->_conn->beginTransaction(); $this->_conn->beginTransaction();
} else { } else {
$savepointName = $this->_getNestedTransactionSavePointName($this->_transactionNestingLevel); $savepointName = $this->_getNestedTransactionSavePointName();
if ($savepointName) { if ($savepointName) {
$this->createSavePoint($savepointName); $this->createSavePoint($savepointName);
} }
...@@ -831,7 +831,7 @@ class Connection implements DriverConnection ...@@ -831,7 +831,7 @@ class Connection implements DriverConnection
if ($this->_transactionNestingLevel == 1) { if ($this->_transactionNestingLevel == 1) {
$this->_conn->commit(); $this->_conn->commit();
} else { } else {
$savepointName = $this->_getNestedTransactionSavePointName($this->_transactionNestingLevel); $savepointName = $this->_getNestedTransactionSavePointName();
if ($savepointName && $this->_platform->supportsReleaseSavepoints()) { if ($savepointName && $this->_platform->supportsReleaseSavepoints()) {
$this->releaseSavePoint($savepointName); $this->releaseSavePoint($savepointName);
} }
...@@ -861,7 +861,7 @@ class Connection implements DriverConnection ...@@ -861,7 +861,7 @@ class Connection implements DriverConnection
$this->_conn->rollback(); $this->_conn->rollback();
$this->_isRollbackOnly = false; $this->_isRollbackOnly = false;
} else { } else {
$savepointName = $this->_getNestedTransactionSavePointName($this->_transactionNestingLevel); $savepointName = $this->_getNestedTransactionSavePointName();
if (!$this->_isRollbackOnly && $savepointName) { if (!$this->_isRollbackOnly && $savepointName) {
$this->rollbackSavePoint($savepointName); $this->rollbackSavePoint($savepointName);
} else { } else {
......
...@@ -549,4 +549,16 @@ class DB2Platform extends AbstractPlatform ...@@ -549,4 +549,16 @@ class DB2Platform extends AbstractPlatform
{ {
return 'SELECT 1 FROM sysibm.sysdummy1'; return 'SELECT 1 FROM sysibm.sysdummy1';
} }
/**
* DB2 supports savepoints, but they work semantically different than on other vendor platforms.
*
* TODO: We have to investigate how to get DB2 up and running with savepoints.
*
* @return bool
*/
public function supportsSavepoints()
{
return false;
}
} }
\ No newline at end of file
...@@ -56,7 +56,10 @@ class ConnectionTest extends \Doctrine\Tests\DbalFunctionalTestCase ...@@ -56,7 +56,10 @@ class ConnectionTest extends \Doctrine\Tests\DbalFunctionalTestCase
public function testTransactionNestingBehaviorWithSavepoints() public function testTransactionNestingBehaviorWithSavepoints()
{ {
if ($this->_conn->getDatabasePlatform()->supportsSavepoints()) { if (!$this->_conn->getDatabasePlatform()->supportsSavepoints()) {
$this->markTestSkipped('This test requires the platform to support savepoints.');
}
$this->_conn->setNestTransactionsWithSavepoints(true); $this->_conn->setNestTransactionsWithSavepoints(true);
try { try {
$this->_conn->beginTransaction(); $this->_conn->beginTransaction();
...@@ -89,7 +92,6 @@ class ConnectionTest extends \Doctrine\Tests\DbalFunctionalTestCase ...@@ -89,7 +92,6 @@ class ConnectionTest extends \Doctrine\Tests\DbalFunctionalTestCase
$this->_conn->rollback(); $this->_conn->rollback();
} }
} }
}
public function testTransactionBehaviorWithRollback() public function testTransactionBehaviorWithRollback()
{ {
......
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