From 6ec5ddb02d6178fbba88d52e8130ca0b818a827c Mon Sep 17 00:00:00 2001 From: loks0n <22452787+loks0n@users.noreply.github.com> Date: Tue, 24 Nov 2026 02:46:32 +0000 Subject: [PATCH] fix(sqlite): declare the LIKE escape once The SQLite builder appends ESCAPE '\' to every LIKE, because utopia-php/query declared none. A coming release of that package declares it itself (appwrite/appwrite#15328), and SQLite refuses the clause twice: LIKE ? ESCAPE '\' ESCAPE '\' is a syntax error. The builder now adds the clause only when the statement does not end in it already, so it works on both sides of that release. Co-Authored-By: Claude Fable 5.2 --- src/Database/Builder/SQLite.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Database/Builder/SQLite.php b/src/Database/Builder/SQLite.php index 16d89317e..ea0d806dd 100644 --- a/src/Database/Builder/SQLite.php +++ b/src/Database/Builder/SQLite.php @@ -50,7 +50,10 @@ protected function compileRegex(string $attribute, array $values, ?string $colum #[\Override] protected function compileLike(string $attribute, array $values, string $prefix, string $suffix, bool $not, ?string $column = null): string { - return parent::compileLike($attribute, $values, $prefix, $suffix, $not, $column).self::ESCAPE; + $like = parent::compileLike($attribute, $values, $prefix, $suffix, $not, $column); + + // utopia-php/query is about to declare this clause itself, and SQLite refuses it twice. + return \str_ends_with($like, self::ESCAPE) ? $like : $like.self::ESCAPE; } /**