mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-31 09:06:17 +00:00
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:
parent
2c1b7fc24e
commit
d9489b942b
2 changed files with 16 additions and 14 deletions
|
@ -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.
|
||||
*
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
?>
|
Loading…
Add table
Reference in a new issue