[db] Make db_file_add/update + library_media_save return id of mfi

This commit is contained in:
ejurgensen 2020-11-21 23:13:17 +01:00
parent b6a686866a
commit 21c80fbf10
2 changed files with 10 additions and 3 deletions

View File

@ -3099,9 +3099,16 @@ db_file_add(struct media_file_info *mfi)
if (ret < 0)
return -1;
ret = (int)sqlite3_last_insert_rowid(hdl);
if (ret == 0)
{
DPRINTF(E_LOG, L_DB, "Successful file insert but no last_insert_rowid!\n");
return -1;
}
library_update_trigger(LISTENER_DATABASE);
return 0;
return ret;
}
int
@ -3129,7 +3136,7 @@ db_file_update(struct media_file_info *mfi)
library_update_trigger(LISTENER_DATABASE);
return 0;
return mfi->id;
}
void

View File

@ -120,7 +120,7 @@ struct library_source
* Adds a mfi if mfi->id == 0, otherwise updates.
*
* @param mfi Media to save
* @return 0 if operation succeeded, -1 on failure.
* @return mfi id if operation succeeded, -1 on failure.
*/
int
library_media_save(struct media_file_info *mfi);