[db] Do not notify clients in 'db_queue_add_by_query' if no items were

added
This commit is contained in:
chme 2017-03-05 08:46:00 +01:00 committed by ejurgensen
parent a65737b4e7
commit f5c65d1eef
1 changed files with 8 additions and 2 deletions

View File

@ -4194,6 +4194,13 @@ db_queue_add_by_query(struct query_params *qp, char reshuffle, uint32_t item_id)
DPRINTF(E_DBG, L_DB, "Player queue query returned %d items\n", qp->results); DPRINTF(E_DBG, L_DB, "Player queue query returned %d items\n", qp->results);
if (qp->results == 0)
{
db_query_end(qp);
db_transaction_end();
return 0;
}
while (((ret = db_query_fetch_file(qp, &dbmfi)) == 0) && (dbmfi.id)) while (((ret = db_query_fetch_file(qp, &dbmfi)) == 0) && (dbmfi.id))
{ {
ret = queue_add_file(&dbmfi, pos, pos); ret = queue_add_file(&dbmfi, pos, pos);
@ -4217,7 +4224,6 @@ db_queue_add_by_query(struct query_params *qp, char reshuffle, uint32_t item_id)
return -1; return -1;
} }
if (pos > 0)
ret = (int) sqlite3_last_insert_rowid(hdl); ret = (int) sqlite3_last_insert_rowid(hdl);
db_transaction_end(); db_transaction_end();