From c0f10437eae7ecee01bd81e3a6b8af99e2d11021 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Lorenzo=20Rodr=C3=ADguez?= Date: Tue, 16 Nov 2010 23:14:48 -0430 Subject: [PATCH] Adding a few transactions to speed up a little tests involving fixtures --- cake/libs/model/datasources/dbo_source.php | 3 ++- cake/tests/lib/cake_fixture_manager.php | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/cake/libs/model/datasources/dbo_source.php b/cake/libs/model/datasources/dbo_source.php index 003c6acca..df3c2dfa6 100755 --- a/cake/libs/model/datasources/dbo_source.php +++ b/cake/libs/model/datasources/dbo_source.php @@ -2687,11 +2687,12 @@ class DboSource extends DataSource { $count = count($values); $sql = "INSERT INTO {$table} ({$fields}) VALUES ({$holder})"; $statement = $this->_connection->prepare($sql); + $this->begin(); for ($x = 0; $x < $count; $x++) { $statement->execute($values[$x]); $statement->closeCursor(); } - return true; + return $this->commit(); } /** diff --git a/cake/tests/lib/cake_fixture_manager.php b/cake/tests/lib/cake_fixture_manager.php index 2643335f3..a7718e49e 100644 --- a/cake/tests/lib/cake_fixture_manager.php +++ b/cake/tests/lib/cake_fixture_manager.php @@ -206,6 +206,7 @@ class CakeFixtureManager { return; } + $test->db->begin(); foreach ($fixtures as $f) { if (!empty($this->_loaded[$f])) { $fixture = $this->_loaded[$f]; @@ -213,6 +214,7 @@ class CakeFixtureManager { $fixture->insert($test->db); } } + $test->db->commit(); } /**