backend_firefox: fix sqlite version compatibility

In commit 348f13df02, 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.
This commit is contained in:
CismonX 2025-03-29 16:14:10 +08:00
parent 1bbe928e50
commit 63d8b8e213
No known key found for this signature in database
GPG key ID: 3094873E29A482FB

View file

@ -2146,7 +2146,7 @@ bookmark_do_list (
// Type: 1 -> bookmark; 2 -> folder; 3 -> separator. // Type: 1 -> bookmark; 2 -> folder; 3 -> separator.
#define BOOKMARK_LIST_NOJOIN_(col) BOOKMARK_LIST_(col ", 1 - `b`.`type` ", ) #define BOOKMARK_LIST_NOJOIN_(col) BOOKMARK_LIST_(col ", 1 - `b`.`type` ", )
#define BOOKMARK_LIST_EX_COLS_ \ #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`" "`p`.`last_visit_date`"
#define BOOKMARK_LIST_EX_(col) \ #define BOOKMARK_LIST_EX_(col) \
BOOKMARK_LIST_(col ", " BOOKMARK_LIST_EX_COLS_ " ", \ BOOKMARK_LIST_(col ", " BOOKMARK_LIST_EX_COLS_ " ", \
@ -2237,7 +2237,7 @@ bookmark_do_lookup (
) { ) {
#define BOOKMARK_LOOKUP_(join, where) \ #define BOOKMARK_LOOKUP_(join, where) \
"SELECT `b`.`id`, `b`.`lastModified`, " \ "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` " \ "FROM `moz_bookmarks` `b` " \
join "JOIN `moz_places` `p` ON `b`.`fk` = `p`.`id` WHERE " where join "JOIN `moz_places` `p` ON `b`.`fk` = `p`.`id` WHERE " where
#define BOOKMARK_LOOKUP_ASSOC_(col) \ #define BOOKMARK_LOOKUP_ASSOC_(col) \