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

DBAL-55 - Final cleanups

parent 6abf6aaf
......@@ -803,7 +803,7 @@ class Connection implements DriverConnection
if ($this->_transactionNestingLevel == 1) {
$this->_conn->beginTransaction();
} else {
$savepointName = $this->_getNestedTransactionSavePointName($this->_transactionNestingLevel);
$savepointName = $this->_getNestedTransactionSavePointName();
if ($savepointName) {
$this->createSavePoint($savepointName);
}
......@@ -831,7 +831,7 @@ class Connection implements DriverConnection
if ($this->_transactionNestingLevel == 1) {
$this->_conn->commit();
} else {
$savepointName = $this->_getNestedTransactionSavePointName($this->_transactionNestingLevel);
$savepointName = $this->_getNestedTransactionSavePointName();
if ($savepointName && $this->_platform->supportsReleaseSavepoints()) {
$this->releaseSavePoint($savepointName);
}
......@@ -861,7 +861,7 @@ class Connection implements DriverConnection
$this->_conn->rollback();
$this->_isRollbackOnly = false;
} else {
$savepointName = $this->_getNestedTransactionSavePointName($this->_transactionNestingLevel);
$savepointName = $this->_getNestedTransactionSavePointName();
if (!$this->_isRollbackOnly && $savepointName) {
$this->rollbackSavePoint($savepointName);
} else {
......
......@@ -549,4 +549,16 @@ class DB2Platform extends AbstractPlatform
{
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
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);
try {
$this->_conn->beginTransaction();
......@@ -89,7 +92,6 @@ class ConnectionTest extends \Doctrine\Tests\DbalFunctionalTestCase
$this->_conn->rollback();
}
}
}
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