mirror of
https://github.com/owntone/owntone-server.git
synced 2025-11-28 05:04:16 -05:00
[db] Refactor fetching query result into generic function
Additionally changes the return value in case the end of the result set is reached.
This commit is contained in:
@@ -1766,7 +1766,7 @@ process_items(struct artwork_ctx *ctx, int item_mode)
|
||||
return -1;
|
||||
}
|
||||
|
||||
while (((ret = db_query_fetch_file(&ctx->qp, &dbmfi)) == 0) && (dbmfi.id))
|
||||
while ((ret = db_query_fetch_file(&ctx->qp, &dbmfi)) == 0)
|
||||
{
|
||||
// Save the first songalbumid, might need it for process_group() if this search doesn't give anything
|
||||
if (!ctx->persistentid)
|
||||
@@ -1859,7 +1859,7 @@ process_group(struct artwork_ctx *ctx)
|
||||
goto invalid_group;
|
||||
}
|
||||
|
||||
is_valid = (db_query_fetch_file(&ctx->qp, &dbmfi) == 0 && dbmfi.id && strcmp(dbmfi.album, CFG_NAME_UNKNOWN_ALBUM) != 0 && strcmp(dbmfi.album_artist, CFG_NAME_UNKNOWN_ARTIST) != 0);
|
||||
is_valid = (db_query_fetch_file(&ctx->qp, &dbmfi) == 0 && strcmp(dbmfi.album, CFG_NAME_UNKNOWN_ALBUM) != 0 && strcmp(dbmfi.album_artist, CFG_NAME_UNKNOWN_ARTIST) != 0);
|
||||
db_query_end(&ctx->qp);
|
||||
if (!is_valid)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user