From b2e3f8ea6e7dbecb8692e7d13bd3c673d4380042 Mon Sep 17 00:00:00 2001 From: Jim Broadus Date: Thu, 25 Mar 2021 10:47:25 -0700 Subject: [PATCH] smartplaylists: Cast filename to TEXT in queries In some versions/builds of sqlite, the LIKE function won't match blobs. Reference: https://www.sqlite.org/compile.html#like_doesnt_match_blobs --- src/smartplaylists/searchterm.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/smartplaylists/searchterm.cpp b/src/smartplaylists/searchterm.cpp index 8795a6cc1..5eec6e44a 100644 --- a/src/smartplaylists/searchterm.cpp +++ b/src/smartplaylists/searchterm.cpp @@ -74,8 +74,10 @@ QString SearchTerm::ToSql() const { } // File paths need some extra processing since they are stored as - // encoded urls in the database. + // encoded urls in the database. In some versions of sqlite, the + // LIKE function doesn't handle the blob form, so cast it to TEXT. if (field_ == Field_Filepath) { + col = "CAST (" + col + " AS TEXT)"; if (operator_ == Op_StartsWith || operator_ == Op_Equals) { value = QUrl::fromLocalFile(value).toEncoded(); } else {