Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Removing duplicate START TRANSACTION sql execution in mysqli environm…

…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...
commit d9489b942b30e1d0809798e9e96595740f181126 1 parent 2c1b7fc
@tim-kos tim-kos authored
View
14 cake/libs/model/datasources/dbo/dbo_mysqli.php
@@ -233,20 +233,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.
*
* @return string Error message with error number
View
16 cake/tests/cases/libs/model/datasources/dbo/dbo_mysqli.test.php
@@ -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);
+ }
}
?>
Please sign in to comment.
Something went wrong with that request. Please try again.