Skip to content

Commit

Permalink
Removing duplicate START TRANSACTION sql execution in mysqli environm…
Browse files Browse the repository at this point in the history
…ent, fixes #6422

git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@8191 3807eeeb-6ff5-0310-8944-8be069107fe0
  • Loading branch information
DarkAngelBGE committed Jun 6, 2009
1 parent 2c1b7fc commit d9489b9
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 14 deletions.
14 changes: 0 additions & 14 deletions cake/libs/model/datasources/dbo/dbo_mysqli.php
Expand Up @@ -232,20 +232,6 @@ function value($data, $column = null, $safe = false) {

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.
*
Expand Down
16 changes: 16 additions & 0 deletions cake/tests/cases/libs/model/datasources/dbo/dbo_mysqli.test.php
Expand Up @@ -297,5 +297,21 @@ function testColumn() {
$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);
}
}
?>

0 comments on commit d9489b9

Please sign in to comment.