Skip to content

Commit 2178eb3

Browse files
committed
SQLiteJournal: 'Too many variables' bug fixed [Closes #25]
1 parent 6f86336 commit 2178eb3

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/Caching/Storages/SQLiteJournal.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -116,17 +116,17 @@ public function clean(array $conditions)
116116
return [];
117117
}
118118

119-
$stmt = $this->pdo->prepare(implode(' UNION ', $unions));
119+
$unionSql = implode(' UNION ', $unions);
120+
$stmt = $this->pdo->prepare($unionSql);
120121
$stmt->execute($args);
121122
$keys = $stmt->fetchAll(\PDO::FETCH_COLUMN, 0);
122123
if (empty($keys)) {
123124
return [];
124125
}
125126

126-
$in = '(?' . str_repeat(', ?', count($keys) - 1) . ')';
127127
$this->pdo->exec('BEGIN');
128-
$this->pdo->prepare("DELETE FROM tags WHERE key IN $in")->execute($keys);
129-
$this->pdo->prepare("DELETE FROM priorities WHERE key IN $in")->execute($keys);
128+
$this->pdo->prepare("DELETE FROM tags WHERE key IN ($unionSql)")->execute($args);
129+
$this->pdo->prepare("DELETE FROM priorities WHERE key IN ($unionSql)")->execute($args);
130130
$this->pdo->exec('COMMIT');
131131

132132
return $keys;

0 commit comments

Comments
 (0)