1
0
mirror of https://github.com/clementine-player/Clementine synced 2025-01-18 04:27:07 +01:00

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
This commit is contained in:
Jim Broadus 2021-03-25 10:47:25 -07:00 committed by John Maguire
parent eb1b84b281
commit b2e3f8ea6e

View File

@ -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 {