10000 minor #52717 [Cache] Get TRUNCATE statement from platform (derrabus) · symfonyaml/symfony@b6404af · GitHub
[go: up one dir, main page]

Skip to content

Commit b6404af

Browse files
minor symfony#52717 [Cache] Get TRUNCATE statement from platform (derrabus)
This PR was merged into the 6.4 branch. Discussion ---------- [Cache] Get TRUNCATE statement from platform | Q | A | ------------- | --- | Branch? | 6.4 | Bug fix? | no | New feature? | no | Deprecations? | no | Issues | N/A | License | MIT The DBAL platform knows how to build a `TRUNCATE` query and which databases support it. Let's leverage that functionality. Commits ------- 7cac14d [Cache] Get TRUNCATE statement from platform
2 parents 75a6cbb + 7cac14d commit b6404af

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

src/Symfony/Component/Cache/Adapter/DoctrineDbalAdapter.php

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -213,11 +213,7 @@ protected function doHave(string $id): bool
213213
protected function doClear(string $namespace): bool
214214
{
215215
if ('' === $namespace) {
216-
if ('sqlite' === $this->getPlatformName()) {
217-
$sql = "DELETE FROM $this->table";
218-
} else {
219-
$sql = "TRUNCATE TABLE $this->table";
220-
}
216+
$sql = $this->conn->getDatabasePlatform()->getTruncateTableSQL($this->table);
221217
} else {
222218
$sql = "DELETE FROM $this->table WHERE $this->idCol LIKE '$namespace%'";
223219
}

0 commit comments

Comments
 (0)
0