summaryrefslogtreecommitdiff
path: root/src/rollback.cpp
diff options
context:
space:
mode:
authorsapier <Sapier at GMX dot net>2014-06-22 02:31:24 +0200
committersapier <Sapier at GMX dot net>2014-06-22 13:38:51 +0200
commit9056c163a738a2f66725ca9a3e48b59b2b0e2603 (patch)
tree8d668fccbd76b64f7cedf05b184bc3a68ffaff4d /src/rollback.cpp
parentd4245e6cac58a57ad2498eee2c17e851f3292296 (diff)
downloadminetest-9056c163a738a2f66725ca9a3e48b59b2b0e2603.tar.gz
minetest-9056c163a738a2f66725ca9a3e48b59b2b0e2603.tar.bz2
minetest-9056c163a738a2f66725ca9a3e48b59b2b0e2603.zip
Fix sqlite3 map shutdown fails due to missing to finalize list statement
Add error output on fail to shutdown sqlite3 map db Implement shutdown of sqlite3 rollback db
Diffstat (limited to 'src/rollback.cpp')
-rw-r--r--src/rollback.cpp26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/rollback.cpp b/src/rollback.cpp
index bae81ddb0..36ebd729c 100644
--- a/src/rollback.cpp
+++ b/src/rollback.cpp
@@ -1091,10 +1091,36 @@ public:
SQL_databaseCheck();
}
+#define FINALIZE_STATEMENT(statement) \
+ if ( statement ) \
+ rc = sqlite3_finalize(statement); \
+ if ( rc != SQLITE_OK ) \
+ errorstream << "RollbackManager::~RollbackManager():" \
+ << "Failed to finalize: " << #statement << ": rc=" << rc << std::endl;
~RollbackManager() {
infostream << "RollbackManager::~RollbackManager()" << std::endl;
flush();
+
+ int rc = SQLITE_OK;
+
+ FINALIZE_STATEMENT(dbs_insert)
+ FINALIZE_STATEMENT(dbs_replace)
+ FINALIZE_STATEMENT(dbs_select)
+ FINALIZE_STATEMENT(dbs_select_range)
+ FINALIZE_STATEMENT(dbs_select_withActor)
+ FINALIZE_STATEMENT(dbs_knownActor_select)
+ FINALIZE_STATEMENT(dbs_knownActor_insert)
+ FINALIZE_STATEMENT(dbs_knownNode_select)
+ FINALIZE_STATEMENT(dbs_knownNode_insert)
+
+ if(dbh)
+ rc = sqlite3_close(dbh);
+
+ if (rc != SQLITE_OK) {
+ errorstream << "RollbackManager::~RollbackManager(): "
+ << "Failed to close database: rc=" << rc << std::endl;
+ }
}
void addAction(const RollbackAction &action) {