mirror of
https://github.com/owntone/owntone-server.git
synced 2025-11-11 22:40:17 -05:00
[db] Add "group" attribute to query_params and allow grouping files
This commit is contained in:
6
src/db.c
6
src/db.c
@@ -1616,6 +1616,10 @@ db_build_query_clause(struct query_params *qp)
|
||||
|
||||
if (qp->type & Q_F_BROWSE)
|
||||
qc->group = sqlite3_mprintf("GROUP BY %s", browse_clause[qp->type & ~Q_F_BROWSE].group);
|
||||
else if (qp->group)
|
||||
qc->group = sqlite3_mprintf("GROUP BY %s", qp->group);
|
||||
else
|
||||
qc->group = sqlite3_mprintf("");
|
||||
|
||||
if (qp->filter)
|
||||
qc->where = sqlite3_mprintf("WHERE f.disabled = 0 AND %s", qp->filter);
|
||||
@@ -1707,7 +1711,7 @@ db_build_query_items(struct query_params *qp)
|
||||
return NULL;
|
||||
|
||||
count = sqlite3_mprintf("SELECT COUNT(*) FROM files f %s;", qc->where);
|
||||
query = sqlite3_mprintf("SELECT f.* FROM files f %s %s %s;", qc->where, qc->order, qc->index);
|
||||
query = sqlite3_mprintf("SELECT f.* FROM files f %s %s %s %s;", qc->where, qc->group, qc->order, qc->index);
|
||||
|
||||
db_free_query_clause(qc);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user