From 1653fe0b930189f82bb0547724b8972c7efb5f4b Mon Sep 17 00:00:00 2001 From: Dane Springmeyer Date: Sun, 13 Nov 2011 19:19:22 -0800 Subject: [PATCH] sqlite: let sqlite automatically rollback if needed to avoid potential rollback against no transaction --- plugins/input/sqlite/sqlite_utils.hpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/plugins/input/sqlite/sqlite_utils.hpp b/plugins/input/sqlite/sqlite_utils.hpp index 4e6890965..071e2b703 100644 --- a/plugins/input/sqlite/sqlite_utils.hpp +++ b/plugins/input/sqlite/sqlite_utils.hpp @@ -203,13 +203,21 @@ public: bool existed = boost::filesystem::exists(index_db); boost::shared_ptr ds = boost::make_shared(index_db,flags); - + bool one_success = false; try { + ds->execute("PRAGMA synchronous=OFF"); ds->execute("BEGIN IMMEDIATE TRANSACTION"); - + + /* + ds->execute("PRAGMA journal_mode=WAL"); + ds->execute("PRAGMA fullfsync=1"); + ds->execute("PRAGMA locking_mode = EXCLUSIVE"); + ds->execute("BEGIN EXCLUSIVE TRANSACTION"); + */ + // first drop the index if it already exists std::ostringstream spatial_index_drop_sql; spatial_index_drop_sql << "DROP TABLE IF EXISTS " << index_table; @@ -278,7 +286,6 @@ public: } catch (mapnik::datasource_exception const& ex) { - ds->execute("ROLLBACK"); if (!existed) { try @@ -297,7 +304,6 @@ public: } else if (!existed) { - ds->execute("ROLLBACK"); try { boost::filesystem::remove(index_db);