fix error messages on bad schema

This commit is contained in:
Ron Pedde 2006-04-10 04:27:52 +00:00
parent c7cc788a1d
commit 8ca978322a
5 changed files with 14 additions and 10 deletions

View File

@ -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 */

View File

@ -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;
}

View File

@ -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;

View File

@ -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);

View File

@ -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