mirror of
https://github.com/Combodo/iTop.git
synced 2026-05-01 22:48:45 +02:00
Merge remote-tracking branch 'origin/support/3.2' into develop
This commit is contained in:
@@ -32,6 +32,8 @@ class DoctrineDbalAdapter extends AbstractAdapter implements PruneableInterface
|
||||
{
|
||||
private const MAX_KEY_LENGTH = 255;
|
||||
|
||||
private static int $savepointCounter = 0;
|
||||
|
||||
private MarshallerInterface $marshaller;
|
||||
private Connection $conn;
|
||||
private string $platformName;
|
||||
@@ -244,6 +246,26 @@ class DoctrineDbalAdapter extends AbstractAdapter implements PruneableInterface
|
||||
return $failed;
|
||||
}
|
||||
|
||||
if ($this->conn->isTransactionActive() && $this->conn->getDatabasePlatform()->supportsSavepoints()) {
|
||||
$savepoint = 'cache_save_'.++self::$savepointCounter;
|
||||
try {
|
||||
$this->conn->createSavepoint($savepoint);
|
||||
$failed = $this->doSaveInner($values, $lifetime, $failed);
|
||||
$this->conn->releaseSavepoint($savepoint);
|
||||
|
||||
return $failed;
|
||||
} catch (\Throwable $e) {
|
||||
$this->conn->rollbackSavepoint($savepoint);
|
||||
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->doSaveInner($values, $lifetime, $failed);
|
||||
}
|
||||
|
||||
private function doSaveInner(array $values, int $lifetime, array $failed): array|bool
|
||||
{
|
||||
$platformName = $this->getPlatformName();
|
||||
$insertSql = "INSERT INTO $this->table ($this->idCol, $this->dataCol, $this->lifetimeCol, $this->timeCol) VALUES (?, ?, ?, ?)";
|
||||
|
||||
|
||||
Reference in New Issue
Block a user