From fedf571d34ff977cd517a77598e8d73d8a2a8f46 Mon Sep 17 00:00:00 2001 From: chme Date: Sat, 27 Dec 2014 14:02:32 +0100 Subject: [PATCH] Improve selects for files table by removing the (f.album <> '' AND f.album IS NOT NULL) from the where clause for album and artist. These are unnecessary because forked-daapd makes sure that an artist or album name exists. --- src/DAAP2SQL.g | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/DAAP2SQL.g b/src/DAAP2SQL.g index 1fcbf12f..5d03491f 100644 --- a/src/DAAP2SQL.g +++ b/src/DAAP2SQL.g @@ -194,6 +194,17 @@ expr returns [ pANTLR3_STRING result, int valid ] goto STR_result_valid_0; /* ABORT */ } + /* No need to exclude empty artist and album, as forked-daapd makes sure there always exists an artist/album. */ + if (neg_op && op == ':' + && (strcmp((char *)field, "daap.songalbumartist") == 0 + || strcmp((char *)field, "daap.songartist") == 0 + || strcmp((char *)field, "daap.songalbum") == 0)) + { + DPRINTF(E_DBG, L_DAAP, "Ignoring clause '\%s\%s\%c'\n", field, (neg_op) ? "!" : "", op); + $result->append8($result, "1 = 1"); + goto STR_out; + } + /* Need to check against NULL too */ if (op == ':') $result->append8($result, "(");