Adding a few transactions to speed up a little tests involving fixtures

This commit is contained in:
José Lorenzo Rodríguez 2010-11-16 23:14:48 -04:30
parent 1326707c9d
commit c0f10437ea
2 changed files with 4 additions and 1 deletions

View file

@ -2687,11 +2687,12 @@ class DboSource extends DataSource {
$count = count($values); $count = count($values);
$sql = "INSERT INTO {$table} ({$fields}) VALUES ({$holder})"; $sql = "INSERT INTO {$table} ({$fields}) VALUES ({$holder})";
$statement = $this->_connection->prepare($sql); $statement = $this->_connection->prepare($sql);
$this->begin();
for ($x = 0; $x < $count; $x++) { for ($x = 0; $x < $count; $x++) {
$statement->execute($values[$x]); $statement->execute($values[$x]);
$statement->closeCursor(); $statement->closeCursor();
} }
return true; return $this->commit();
} }
/** /**

View file

@ -206,6 +206,7 @@ class CakeFixtureManager {
return; return;
} }
$test->db->begin();
foreach ($fixtures as $f) { foreach ($fixtures as $f) {
if (!empty($this->_loaded[$f])) { if (!empty($this->_loaded[$f])) {
$fixture = $this->_loaded[$f]; $fixture = $this->_loaded[$f];
@ -213,6 +214,7 @@ class CakeFixtureManager {
$fixture->insert($test->db); $fixture->insert($test->db);
} }
} }
$test->db->commit();
} }
/** /**