diff --git a/scripts/run-turn.lua b/scripts/run-turn.lua index 83d4045ac..34c1ea4fb 100644 --- a/scripts/run-turn.lua +++ b/scripts/run-turn.lua @@ -29,7 +29,7 @@ local function dbupdate() update_scores() if config.dbname then dbname = config.basepath..'/'..config.dbname - edb = db.open(dbame) + edb = db.open(dbname) if edb~=nil then edb:update_factions() edb:update_scores() diff --git a/src/kernel/dbsqlite.c b/src/kernel/dbsqlite.c index 7c1af1146..b57d65937 100644 --- a/src/kernel/dbsqlite.c +++ b/src/kernel/dbsqlite.c @@ -1,6 +1,7 @@ #include #include "db.h" #include "orderdb.h" +#include "config.h" #include @@ -11,8 +12,6 @@ #include #include - -#define DBNAME ":memory:" static sqlite3 *g_db; static sqlite3_stmt * g_stmt_insert; static sqlite3_stmt * g_stmt_select; @@ -65,8 +64,9 @@ int db_save_order(order_data *od) void db_open(void) { int err; + const char *dbname = config_get("config.dbname", ""); - err = sqlite3_open(DBNAME, &g_db); + err = sqlite3_open(dbname, &g_db); assert(err == SQLITE_OK); err = sqlite3_exec(g_db, "CREATE TABLE IF NOT EXISTS orders (id INTEGER PRIMARY KEY, data TEXT NOT NULL)", NULL, NULL, NULL); assert(err == SQLITE_OK);