summaryrefslogtreecommitdiff
path: root/src/database-sqlite3.cpp
diff options
context:
space:
mode:
authorproller <proller@github.com>2013-09-17 02:09:28 +0400
committerproller <proller@github.com>2013-09-17 02:11:30 +0400
commit4c704fe30673eecad0903683fae627b7226c92d6 (patch)
tree42f902b1ad287599fc463ead0152dadb0d292ace /src/database-sqlite3.cpp
parentd308352dbd4121d12d4f44d591463468c09d37f9 (diff)
downloadminetest-4c704fe30673eecad0903683fae627b7226c92d6.tar.gz
minetest-4c704fe30673eecad0903683fae627b7226c92d6.tar.bz2
minetest-4c704fe30673eecad0903683fae627b7226c92d6.zip
Add configurable PRAGMA synchronous =
Diffstat (limited to 'src/database-sqlite3.cpp')
-rw-r--r--src/database-sqlite3.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/database-sqlite3.cpp b/src/database-sqlite3.cpp
index 17484d48c..9714d1035 100644
--- a/src/database-sqlite3.cpp
+++ b/src/database-sqlite3.cpp
@@ -108,7 +108,16 @@ void Database_SQLite3::verifyDatabase() {
if(needs_create)
createDatabase();
-
+
+ std::string querystr = std::string("PRAGMA synchronous = ")
+ + itos(g_settings->getU16("sqlite_synchronous"));
+ d = sqlite3_exec(m_database, querystr.c_str(), NULL, NULL, NULL);
+ if(d != SQLITE_OK) {
+ infostream<<"WARNING: Database pragma set failed: "
+ <<sqlite3_errmsg(m_database)<<std::endl;
+ throw FileNotGoodException("Cannot set pragma");
+ }
+
d = sqlite3_prepare(m_database, "SELECT `data` FROM `blocks` WHERE `pos`=? LIMIT 1", -1, &m_database_read, NULL);
if(d != SQLITE_OK) {
infostream<<"WARNING: SQLite3 database read statment failed to prepare: "<<sqlite3_errmsg(m_database)<<std::endl;