Rename pl_id member of struct query_params
This commit is contained in:
parent
6a144cd670
commit
641e5462cc
16
src/db.c
16
src/db.c
|
@ -583,10 +583,10 @@ db_build_query_plitems_plain(struct query_params *qp, char **q)
|
|||
|
||||
if (qp->filter)
|
||||
count = sqlite3_mprintf("SELECT COUNT(*) FROM files JOIN playlistitems ON files.path = playlistitems.filepath"
|
||||
" WHERE playlistitems.playlistid = %d AND files.disabled = 0 AND %s;", qp->pl_id, qp->filter);
|
||||
" WHERE playlistitems.playlistid = %d AND files.disabled = 0 AND %s;", qp->id, qp->filter);
|
||||
else
|
||||
count = sqlite3_mprintf("SELECT COUNT(*) FROM files JOIN playlistitems ON files.path = playlistitems.filepath"
|
||||
" WHERE playlistitems.playlistid = %d AND files.disabled = 0;", qp->pl_id);
|
||||
" WHERE playlistitems.playlistid = %d AND files.disabled = 0;", qp->id);
|
||||
|
||||
if (!count)
|
||||
{
|
||||
|
@ -609,19 +609,19 @@ db_build_query_plitems_plain(struct query_params *qp, char **q)
|
|||
if (idx && qp->filter)
|
||||
query = sqlite3_mprintf("SELECT files.* FROM files JOIN playlistitems ON files.path = playlistitems.filepath"
|
||||
" WHERE playlistitems.playlistid = %d AND files.disabled = 0 AND %s ORDER BY playlistitems.id ASC %s;",
|
||||
qp->pl_id, qp->filter, idx);
|
||||
qp->id, qp->filter, idx);
|
||||
else if (idx)
|
||||
query = sqlite3_mprintf("SELECT files.* FROM files JOIN playlistitems ON files.path = playlistitems.filepath"
|
||||
" WHERE playlistitems.playlistid = %d AND files.disabled = 0 ORDER BY playlistitems.id ASC %s;",
|
||||
qp->pl_id, idx);
|
||||
qp->id, idx);
|
||||
else if (qp->filter)
|
||||
query = sqlite3_mprintf("SELECT files.* FROM files JOIN playlistitems ON files.path = playlistitems.filepath"
|
||||
" WHERE playlistitems.playlistid = %d AND files.disabled = 0 AND %s ORDER BY playlistitems.id ASC;",
|
||||
qp->pl_id, qp->filter);
|
||||
qp->id, qp->filter);
|
||||
else
|
||||
query = sqlite3_mprintf("SELECT files.* FROM files JOIN playlistitems ON files.path = playlistitems.filepath"
|
||||
" WHERE playlistitems.playlistid = %d AND files.disabled = 0 ORDER BY playlistitems.id ASC;",
|
||||
qp->pl_id);
|
||||
qp->id);
|
||||
|
||||
if (!query)
|
||||
{
|
||||
|
@ -688,13 +688,13 @@ db_build_query_plitems(struct query_params *qp, char **q)
|
|||
struct playlist_info *pli;
|
||||
int ret;
|
||||
|
||||
if (qp->pl_id <= 0)
|
||||
if (qp->id <= 0)
|
||||
{
|
||||
DPRINTF(E_LOG, L_DB, "No playlist id specified in playlist items query\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
pli = db_pl_fetch_byid(qp->pl_id);
|
||||
pli = db_pl_fetch_byid(qp->id);
|
||||
if (!pli)
|
||||
return -1;
|
||||
|
||||
|
|
2
src/db.h
2
src/db.h
|
@ -33,7 +33,7 @@ struct query_params {
|
|||
/* Query parameters, filled in by caller */
|
||||
enum query_type type;
|
||||
enum index_type idx_type;
|
||||
int pl_id;
|
||||
int id;
|
||||
int offset;
|
||||
int limit;
|
||||
|
||||
|
|
|
@ -1400,7 +1400,7 @@ daap_reply_songlist_generic(struct evhttp_request *req, struct evbuffer *evbuf,
|
|||
if (playlist != -1)
|
||||
{
|
||||
qp.type = Q_PLITEMS;
|
||||
qp.pl_id = playlist;
|
||||
qp.id = playlist;
|
||||
}
|
||||
else
|
||||
qp.type = Q_ITEMS;
|
||||
|
|
|
@ -459,14 +459,14 @@ rsp_reply_playlist(struct evhttp_request *req, char **uri, struct evkeyvalq *que
|
|||
|
||||
memset(&qp, 0, sizeof(struct query_params));
|
||||
|
||||
ret = safe_atoi32(uri[2], &qp.pl_id);
|
||||
ret = safe_atoi32(uri[2], &qp.id);
|
||||
if (ret < 0)
|
||||
{
|
||||
rsp_send_error(req, "Invalid playlist ID");
|
||||
return;
|
||||
}
|
||||
|
||||
if (qp.pl_id == 0)
|
||||
if (qp.id == 0)
|
||||
qp.type = Q_ITEMS;
|
||||
else
|
||||
qp.type = Q_PLITEMS;
|
||||
|
@ -663,7 +663,7 @@ rsp_reply_browse(struct evhttp_request *req, char **uri, struct evkeyvalq *query
|
|||
return;
|
||||
}
|
||||
|
||||
ret = safe_atoi32(uri[2], &qp.pl_id);
|
||||
ret = safe_atoi32(uri[2], &qp.id);
|
||||
if (ret < 0)
|
||||
{
|
||||
rsp_send_error(req, "Invalid playlist ID");
|
||||
|
|
Loading…
Reference in New Issue