EDA/SQLite: Setting locking_mode to normal on closing DB to get rid of journal
authorJerome St-Louis <jerome@ecere.com>
Mon, 30 Sep 2013 08:45:41 +0000 (04:45 -0400)
committerJerome St-Louis <jerome@ecere.com>
Mon, 30 Sep 2013 08:45:41 +0000 (04:45 -0400)
- Also forcing locking_mode to exclusive on non-readonly DB for Linux where using system library without config option

eda/drivers/sqlite/EDASQLite.ec

index 0b45c73..ceeadc9 100644 (file)
@@ -205,6 +205,7 @@ class SQLiteDataSource : DataSourceDriver
             {
                if(createOptions != readOnly)
                {
+                  sqlite3_exec(db, "PRAGMA locking_mode=exclusive", null, null, null);
                   sqlite3_exec(db, "DELETE FROM eda_table_fields WHERE Name = 'lockDummy'", null, null, null);
                   if(sqlite3_exec(db, "INSERT INTO eda_table_fields (Table_Name, Name, Type, Length) VALUES ('lockDummy', 'lockDummy', 'lockDummy', 'lockDummy')", null, null, null))
                      success = false;
@@ -266,6 +267,7 @@ class SQLiteDatabase : Database
    
    ~SQLiteDatabase()
    {
+      sqlite3_exec(db, "PRAGMA locking_mode=normal", null, null, null);
       sqlite3_close(db);
    }