From 8ca978322a9732e3ede9583fca1f737caa1a99e3 Mon Sep 17 00:00:00 2001 From: Ron Pedde Date: Mon, 10 Apr 2006 04:27:52 +0000 Subject: [PATCH] fix error messages on bad schema --- src/db-generic.c | 2 +- src/db-sql-sqlite2.c | 3 ++- src/db-sql-sqlite3.c | 8 +++----- src/main.c | 10 ++++++++-- src/mtd-update.c | 1 - 5 files changed, 14 insertions(+), 10 deletions(-) diff --git a/src/db-generic.c b/src/db-generic.c index 8968ff0d..2130c378 100644 --- a/src/db-generic.c +++ b/src/db-generic.c @@ -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 */ diff --git a/src/db-sql-sqlite2.c b/src/db-sql-sqlite2.c index 14833ce7..01cb1836 100644 --- a/src/db-sql-sqlite2.c +++ b/src/db-sql-sqlite2.c @@ -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; } diff --git a/src/db-sql-sqlite3.c b/src/db-sql-sqlite3.c index 3ad56907..c48e6381 100644 --- a/src/db-sql-sqlite3.c +++ b/src/db-sql-sqlite3.c @@ -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; diff --git a/src/main.c b/src/main.c index a295904b..d3bd9084 100644 --- a/src/main.c +++ b/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); diff --git a/src/mtd-update.c b/src/mtd-update.c index cfb51016..71b36df3 100644 --- a/src/mtd-update.c +++ b/src/mtd-update.c @@ -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