From 6fca7734261f4a152a2eca533bf7bedd39371330 Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Sun, 28 Jan 2018 18:26:54 +0100 Subject: [PATCH] BUG 2416: prefer sqlite over db --- src/CMakeLists.txt | 16 ++++++++-------- src/bindings.c | 7 ++++++- src/kernel/CMakeLists.txt | 8 ++++---- src/kernel/db/berkeley.c | 2 ++ 4 files changed, 20 insertions(+), 13 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 7518bb2d4..177905c96 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -282,19 +282,19 @@ target_link_libraries(eressea bsd) target_link_libraries(convert bsd) endif (HAVE_LIBBSD) -if (DB_FOUND) -include_directories (${DB_INCLUDE_DIR}) -target_link_libraries(convert ${DB_LIBRARIES}) -target_link_libraries(eressea ${DB_LIBRARIES}) -target_link_libraries(test_eressea ${DB_LIBRARIES}) -add_definitions(-DUSE_DB) -elseif (SQLITE3_FOUND) +if (SQLITE3_FOUND) include_directories (${SQLITE3_INCLUDE_DIR}) target_link_libraries(eressea ${SQLITE3_LIBRARIES}) target_link_libraries(convert ${SQLITE3_LIBRARIES}) target_link_libraries(test_eressea ${SQLITE3_LIBRARIES}) add_definitions(-DUSE_SQLITE) -endif(DB_FOUND) +elseif (DB_FOUND) +include_directories (${DB_INCLUDE_DIR}) +target_link_libraries(convert ${DB_LIBRARIES}) +target_link_libraries(eressea ${DB_LIBRARIES}) +target_link_libraries(test_eressea ${DB_LIBRARIES}) +add_definitions(-DUSE_DB) +endif(SQLITE3_FOUND) if (CURSES_FOUND) include_directories (${CURSES_INCLUDE_DIR}) diff --git a/src/bindings.c b/src/bindings.c index 4bf999af1..96ba2691d 100755 --- a/src/bindings.c +++ b/src/bindings.c @@ -480,6 +480,12 @@ static int tolua_write_reports(lua_State * L) static int tolua_process_orders(lua_State * L) { UNUSED_ARG(L); +#if 0 + order * ord = parse_order("@GIB xmis ALLES Gurgelkraut", default_locale); + assert(ord); + free_order(ord); + return 0; +#endif processorders(); return 0; } @@ -1166,7 +1172,6 @@ int eressea_run(lua_State *L, const char *luafile) { int err; global.vm_state = L; - /* push an error handling function on the stack: */ lua_getglobal(L, "debug"); lua_getfield(L, -1, "traceback"); diff --git a/src/kernel/CMakeLists.txt b/src/kernel/CMakeLists.txt index 9e5a38ed2..cb8373fa2 100644 --- a/src/kernel/CMakeLists.txt +++ b/src/kernel/CMakeLists.txt @@ -36,11 +36,11 @@ unit.test.c SET(_DBFILES db/critbit.c) -IF(DB_FOUND) -SET(_DBFILES db/berkeley.c) -ELSEIF(SQLITE3_FOUND) +IF(SQLITE3_FOUND) SET(_DBFILES db/sqlite.c) -ENDIF(DB_FOUND) +ELSEIF(DB_FOUND) +SET(_DBFILES db/berkeley.c) +ENDIF(SQLITE3_FOUND) SET(_FILES ${_DBFILES} diff --git a/src/kernel/db/berkeley.c b/src/kernel/db/berkeley.c index c16a6d13a..210c36f01 100644 --- a/src/kernel/db/berkeley.c +++ b/src/kernel/db/berkeley.c @@ -40,6 +40,8 @@ int db_driver_order_save(struct order_data *od) db_recno_t recno; assert(od && od->_str); + memset(&key, 0, sizeof(DBT)); + memset(&data, 0, sizeof(DBT)); key.data = &recno; key.size = key.ulen = sizeof(recno); key.flags = DB_DBT_USERMEM;