fix error messages on bad schema
This commit is contained in:
parent
c7cc788a1d
commit
8ca978322a
|
@ -350,7 +350,7 @@ char *db_error_list[] = {
|
|||
"No backend database support for type: %s",
|
||||
"Could not initialize thread pool",
|
||||
"Passed buffer too small for result",
|
||||
"Wrong database version. Try using mt-dbupdate to update the db"
|
||||
"Wrong db schema. Use mtd-update to upgrade the db."
|
||||
};
|
||||
|
||||
/* Globals */
|
||||
|
|
|
@ -149,7 +149,8 @@ int db_sqlite2_open(char **pe, char *dsn) {
|
|||
DPRINTF(E_LOG,L_DB,"Can't get db version. New database?\n");
|
||||
} else if(ver != DB_SQLITE2_VERSION) {
|
||||
/* we'll deal with this in the db handler */
|
||||
DPRINTF(E_LOG,L_DB,"Old database version -- forcing rescan\n");
|
||||
DPRINTF(E_LOG,L_DB,"Old database version.\n");
|
||||
db_get_error(pe,DB_E_WRONGVERSION);
|
||||
return DB_E_WRONGVERSION;
|
||||
}
|
||||
|
||||
|
|
|
@ -149,11 +149,9 @@ int db_sqlite3_open(char **pe, char *dsn) {
|
|||
/* we'll catch this on the init */
|
||||
DPRINTF(E_LOG,L_DB,"Can't get db version. New database?\n");
|
||||
} else if(ver != DB_SQLITE3_VERSION) {
|
||||
DPRINTF(E_LOG,L_DB,"Old database version -- forcing rescan\n");
|
||||
err=db_sqlite3_exec(pe,E_FATAL,"insert into config (term,value) "
|
||||
"values ('rescan','1')");
|
||||
if(err != DB_E_SUCCESS)
|
||||
return err;
|
||||
DPRINTF(E_LOG,L_DB,"Old database version.\n");
|
||||
db_get_error(pe,DB_E_WRONGVERSION);
|
||||
return DB_E_WRONGVERSION;
|
||||
}
|
||||
|
||||
return DB_E_SUCCESS;
|
||||
|
|
10
src/main.c
10
src/main.c
|
@ -321,8 +321,14 @@ int main(int argc, char *argv[]) {
|
|||
err=db_open(&perr,db_type,db_parms);
|
||||
|
||||
if(err) {
|
||||
DPRINTF(E_FATAL,L_MAIN|L_DB,"Error: db_open %s/%s: %s\n",
|
||||
db_type,db_parms,perr);
|
||||
DPRINTF(E_LOG,L_MAIN|L_DB,"Error opening db: %s\n",perr);
|
||||
#ifndef WITHOUT_MDNS
|
||||
if(config.use_mdns) {
|
||||
rend_stop();
|
||||
}
|
||||
#endif
|
||||
os_deinit();
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
free(db_type);
|
||||
|
|
|
@ -54,7 +54,6 @@ extern int db_sql_fetch_int(char **pe, int *result, char *fmt, ...);
|
|||
# define SQLITE3_UPDATES db_error_updates
|
||||
#endif
|
||||
|
||||
|
||||
extern char *db_sqlite_updates[];
|
||||
char *db_error_updates[] = {
|
||||
NULL
|
||||
|
|
Loading…
Reference in New Issue