From 63d8b8e213139c6fe705d00fad5a7e26755d76a9 Mon Sep 17 00:00:00 2001 From: CismonX Date: Sat, 29 Mar 2025 16:14:10 +0800 Subject: [PATCH] backend_firefox: fix sqlite version compatibility In commit 348f13df02fa560d263e857ad44bd183f100dfe7, we replaced `length(url)` with `octet_length(url)`. However, `octet_length` was added in SQLite 3.43, while we claim to support SQLite 3.35 and later. Stable GNU/Linux distros like Debian may still be using pre-3.43 releases of SQLite, so don't bump that version too soon. Instead, use `length(CAST(url AS BLOB))`, which is a bit less efficient than `octet_length(url)`, but O(1) nonetheless. --- src/backend_firefox.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/backend_firefox.c b/src/backend_firefox.c index 5ac523c..96f74da 100644 --- a/src/backend_firefox.c +++ b/src/backend_firefox.c @@ -2146,7 +2146,7 @@ bookmark_do_list ( // Type: 1 -> bookmark; 2 -> folder; 3 -> separator. #define BOOKMARK_LIST_NOJOIN_(col) BOOKMARK_LIST_(col ", 1 - `b`.`type` ", ) #define BOOKMARK_LIST_EX_COLS_ \ - "ifnull(octet_length(`p`.`url`), -1), `b`.`lastModified`, " \ + "ifnull(length(CAST(`p`.`url` AS BLOB)), -1), `b`.`lastModified`, " \ "`p`.`last_visit_date`" #define BOOKMARK_LIST_EX_(col) \ BOOKMARK_LIST_(col ", " BOOKMARK_LIST_EX_COLS_ " ", \ @@ -2237,7 +2237,7 @@ bookmark_do_lookup ( ) { #define BOOKMARK_LOOKUP_(join, where) \ "SELECT `b`.`id`, `b`.`lastModified`, " \ - "`p`.`last_visit_date`, octet_length(`p`.`url`) " \ + "`p`.`last_visit_date`, length(CAST(`p`.`url` AS BLOB)) " \ "FROM `moz_bookmarks` `b` " \ join "JOIN `moz_places` `p` ON `b`.`fk` = `p`.`id` WHERE " where #define BOOKMARK_LOOKUP_ASSOC_(col) \