Fix error with db purging during rescan
This commit is contained in:
parent
4ba5e7d31d
commit
d8e86bf62d
15
src/main.c
15
src/main.c
@ -312,16 +312,19 @@ int main(int argc, char** argv) {
|
|||||||
sqlite3_close(dbh);
|
sqlite3_close(dbh);
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
|
// Purge db if a rescan is needed
|
||||||
|
if (1 == args_info.rescan_flag) {
|
||||||
|
dberr = sqlite3_exec(dbh, "BEGIN TRANSACTION; DELETE FROM distances; DELETE FROM songs; COMMIT", NULL, NULL, NULL);
|
||||||
|
if (SQLITE_OK != dberr) {
|
||||||
|
fprintf(stderr, "Error purging existing data in db: %s.\n", sqlite3_errmsg(dbh));
|
||||||
|
return EXIT_FAILURE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Close db connection
|
||||||
sqlite3_close(dbh);
|
sqlite3_close(dbh);
|
||||||
|
|
||||||
// Check if a full rescan is needed
|
// Check if a full rescan is needed
|
||||||
if (1 == args_info.rescan_flag) {
|
if (1 == args_info.rescan_flag) {
|
||||||
dberr = sqlite3_exec(dbh, "BEGIN TRANSACTION; DELETE FROM distances; DELETE FROM songs; COMMIT");
|
|
||||||
if (SQLITE_OK != dberr) {
|
|
||||||
fprintf(stderr, "Error purging existing data in db: %s.\n", sqlite3_errmsg(dbh));
|
|
||||||
sqlite3_close(dbh);
|
|
||||||
return EXIT_FAILURE;
|
|
||||||
}
|
|
||||||
update_database(conn, last_mtime, mpd_base_path);
|
update_database(conn, last_mtime, mpd_base_path);
|
||||||
}
|
}
|
||||||
// Else, if we requested an update of the db
|
// Else, if we requested an update of the db
|
||||||
|
Loading…
Reference in New Issue
Block a user