mirror of
https://github.com/Combodo/iTop.git
synced 2026-05-19 07:12:26 +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 (?, ?, ?, ?)";
|
||||
|
||||
|
||||
2
lib/symfony/cache/Adapter/PdoAdapter.php
vendored
2
lib/symfony/cache/Adapter/PdoAdapter.php
vendored
@@ -108,7 +108,7 @@ class PdoAdapter extends AbstractAdapter implements PruneableInterface
|
||||
// - trailing space removal
|
||||
// - case-insensitivity
|
||||
// - language processing like é == e
|
||||
'mysql' => "CREATE TABLE $this->table ($this->idCol VARBINARY(255) NOT NULL PRIMARY KEY, $this->dataCol MEDIUMBLOB NOT NULL, $this->lifetimeCol INTEGER UNSIGNED, $this->timeCol INTEGER UNSIGNED NOT NULL), ENGINE = InnoDB",
|
||||
'mysql' => "CREATE TABLE $this->table ($this->idCol VARBINARY(255) NOT NULL PRIMARY KEY, $this->dataCol MEDIUMBLOB NOT NULL, $this->lifetimeCol INTEGER UNSIGNED, $this->timeCol INTEGER UNSIGNED NOT NULL) ENGINE = InnoDB",
|
||||
'sqlite' => "CREATE TABLE $this->table ($this->idCol TEXT NOT NULL PRIMARY KEY, $this->dataCol BLOB NOT NULL, $this->lifetimeCol INTEGER, $this->timeCol INTEGER NOT NULL)",
|
||||
'pgsql' => "CREATE TABLE $this->table ($this->idCol VARCHAR(255) NOT NULL PRIMARY KEY, $this->dataCol BYTEA NOT NULL, $this->lifetimeCol INTEGER, $this->timeCol INTEGER NOT NULL)",
|
||||
'oci' => "CREATE TABLE $this->table ($this->idCol VARCHAR2(255) NOT NULL PRIMARY KEY, $this->dataCol BLOB NOT NULL, $this->lifetimeCol INTEGER, $this->timeCol INTEGER NOT NULL)",
|
||||
|
||||
Reference in New Issue
Block a user