Removing duplicate START TRANSACTION sql execution in mysqli environment, fixes #6422

git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@8191 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
DarkAngelBGE 2009-06-06 15:41:33 +00:00
parent 2c1b7fc24e
commit d9489b942b
2 changed files with 16 additions and 14 deletions

View file

@ -232,20 +232,6 @@ class DboMysqli extends DboMysqlBase {
return $data;
}
/**
* Begin a transaction
*
* @param unknown_type $model
* @return boolean True on success, false on fail
* (i.e. if the database/model does not support transactions).
*/
function begin(&$model) {
if (parent::begin($model) && $this->execute('START TRANSACTION')) {
$this->_transactionStarted = true;
return true;
}
return false;
}
/**
* Returns a formatted error message from previous database operation.
*

View file

@ -297,5 +297,21 @@ class DboMysqliTest extends CakeTestCase {
$expected = 'float';
$this->assertEqual($result, $expected);
}
/**
* undocumented function
*
* @return void
* @access public
*/
function testTransactions() {
$this->db->begin($this->model);
$this->assertTrue($this->db->_transactionStarted);
$beginSqlCalls = Set::extract('/.[query=START TRANSACTION]', $this->db->_queriesLog);
$this->assertEqual(1, count($beginSqlCalls));
$this->db->commit($this->model);
$this->assertFalse($this->db->_transactionStarted);
}
}
?>