Use DAAP collation for browse queries

This commit is contained in:
Kai Elwert 2010-08-29 10:31:26 +02:00 committed by Julien BLACHE
parent b5e3163d35
commit 5dd58ea7a8

View File

@ -1053,10 +1053,10 @@ db_build_query_browse(struct query_params *qp, char *field, char **q)
int ret;
if (qp->filter)
count = sqlite3_mprintf("SELECT COUNT(DISTINCT %s COLLATE NOCASE) FROM files WHERE data_kind = 0 AND disabled = 0 AND %s != '' AND %s;",
count = sqlite3_mprintf("SELECT COUNT(DISTINCT %s COLLATE DAAP) FROM files WHERE data_kind = 0 AND disabled = 0 AND %s != '' AND %s;",
field, field, qp->filter);
else
count = sqlite3_mprintf("SELECT COUNT(DISTINCT %s COLLATE NOCASE) FROM files WHERE data_kind = 0 AND disabled = 0 AND %s != '';",
count = sqlite3_mprintf("SELECT COUNT(DISTINCT %s COLLATE DAAP) FROM files WHERE data_kind = 0 AND disabled = 0 AND %s != '';",
field, field);
if (!count)
@ -1078,16 +1078,16 @@ db_build_query_browse(struct query_params *qp, char *field, char **q)
return -1;
if (idx && qp->filter)
query = sqlite3_mprintf("SELECT DISTINCT %s COLLATE NOCASE FROM files WHERE data_kind = 0 AND disabled = 0 AND %s != ''"
query = sqlite3_mprintf("SELECT DISTINCT %s COLLATE DAAP FROM files WHERE data_kind = 0 AND disabled = 0 AND %s != ''"
" AND %s %s;", field, field, qp->filter, idx);
else if (idx)
query = sqlite3_mprintf("SELECT DISTINCT %s COLLATE NOCASE FROM files WHERE data_kind = 0 AND disabled = 0 AND %s != ''"
query = sqlite3_mprintf("SELECT DISTINCT %s COLLATE DAAP FROM files WHERE data_kind = 0 AND disabled = 0 AND %s != ''"
" %s;", field, field, idx);
else if (qp->filter)
query = sqlite3_mprintf("SELECT DISTINCT %s COLLATE NOCASE FROM files WHERE data_kind = 0 AND disabled = 0 AND %s != ''"
query = sqlite3_mprintf("SELECT DISTINCT %s COLLATE DAAP FROM files WHERE data_kind = 0 AND disabled = 0 AND %s != ''"
" AND %s;", field, field, qp->filter);
else
query = sqlite3_mprintf("SELECT DISTINCT %s COLLATE NOCASE FROM files WHERE data_kind = 0 AND disabled = 0 AND %s != ''",
query = sqlite3_mprintf("SELECT DISTINCT %s COLLATE DAAP FROM files WHERE data_kind = 0 AND disabled = 0 AND %s != ''",
field, field);
if (!query)