Skip to content
This repository
Browse code

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 Koschuetzki authored June 06, 2009
14  cake/libs/model/datasources/dbo/dbo_mysqli.php
@@ -233,20 +233,6 @@ function value($data, $column = null, $safe = false) {
233 233
 		return $data;
234 234
 	}
235 235
 /**
236  
- * Begin a transaction
237  
- *
238  
- * @param unknown_type $model
239  
- * @return boolean True on success, false on fail
240  
- * (i.e. if the database/model does not support transactions).
241  
- */
242  
-	function begin(&$model) {
243  
-		if (parent::begin($model) && $this->execute('START TRANSACTION')) {
244  
-			$this->_transactionStarted = true;
245  
-			return true;
246  
-		}
247  
-		return false;
248  
-	}
249  
-/**
250 236
  * Returns a formatted error message from previous database operation.
251 237
  *
252 238
  * @return string Error message with error number
16  cake/tests/cases/libs/model/datasources/dbo/dbo_mysqli.test.php
@@ -297,5 +297,21 @@ function testColumn() {
297 297
 		$expected = 'float';
298 298
 		$this->assertEqual($result, $expected);
299 299
 	}
  300
+/**
  301
+ * undocumented function
  302
+ *
  303
+ * @return void
  304
+ * @access public
  305
+ */
  306
+	function testTransactions() {
  307
+		$this->db->begin($this->model);
  308
+		$this->assertTrue($this->db->_transactionStarted);
  309
+
  310
+		$beginSqlCalls = Set::extract('/.[query=START TRANSACTION]', $this->db->_queriesLog);
  311
+		$this->assertEqual(1, count($beginSqlCalls));
  312
+
  313
+		$this->db->commit($this->model);
  314
+		$this->assertFalse($this->db->_transactionStarted);
  315
+	}
300 316
 }
301 317
 ?>

0 notes on commit d9489b9

Please sign in to comment.
Something went wrong with that request. Please try again.