Skip to content

Commit 1557ff6

Browse files
committed
SQLiteJournal: Atomic operations added back [Rel #25]
1 parent 080568d commit 1557ff6

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/Caching/Storages/SQLiteJournal.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,14 +117,18 @@ public function clean(array $conditions)
117117
}
118118

119119
$unionSql = implode(' UNION ', $unions);
120+
121+
$this->pdo->exec('BEGIN IMMEDIATE');
122+
120123
$stmt = $this->pdo->prepare($unionSql);
121124
$stmt->execute($args);
122125
$keys = $stmt->fetchAll(\PDO::FETCH_COLUMN, 0);
126+
123127
if (empty($keys)) {
128+
$this->pdo->exec('COMMIT');
124129
return [];
125130
}
126131

127-
$this->pdo->exec('BEGIN');
128132
$this->pdo->prepare("DELETE FROM tags WHERE key IN ($unionSql)")->execute($args);
129133
$this->pdo->prepare("DELETE FROM priorities WHERE key IN ($unionSql)")->execute($args);
130134
$this->pdo->exec('COMMIT');

0 commit comments

Comments
 (0)