mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-19 02:56:15 +00:00
Adding a few transactions to speed up a little tests involving fixtures
This commit is contained in:
parent
1326707c9d
commit
c0f10437ea
2 changed files with 4 additions and 1 deletions
|
@ -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();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -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();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Add table
Reference in a new issue