[mpd] optimize query selecting files for virtual_path to use the index

This commit is contained in:
chme 2016-01-02 10:21:59 +01:00
parent 5f2fe87351
commit 9a1c8409cf

View File

@ -1557,13 +1557,13 @@ mpd_queueitem_make(char *path, int recursive)
if (recursive) if (recursive)
{ {
qp.filter = sqlite3_mprintf("f.virtual_path LIKE '/%q%%'", path); qp.filter = sqlite3_mprintf("disabled = 0 AND f.virtual_path LIKE '/%q%%'", path);
if (!qp.filter) if (!qp.filter)
DPRINTF(E_DBG, L_PLAYER, "Out of memory\n"); DPRINTF(E_DBG, L_PLAYER, "Out of memory\n");
} }
else else
{ {
qp.filter = sqlite3_mprintf("f.virtual_path LIKE '/%q'", path); qp.filter = sqlite3_mprintf("disabled = 0 AND f.virtual_path LIKE '/%q'", path);
if (!qp.filter) if (!qp.filter)
DPRINTF(E_DBG, L_PLAYER, "Out of memory\n"); DPRINTF(E_DBG, L_PLAYER, "Out of memory\n");
} }