eda/sqlite: Removed check on creation of eda_table_fields table
authorJerome St-Louis <jerome@ecere.com>
Mon, 3 Feb 2014 22:30:13 +0000 (05:30 +0700)
committerJerome St-Louis <jerome@ecere.com>
Mon, 3 Feb 2014 22:30:13 +0000 (05:30 +0700)
- The DB should be locked in exclusive mode even if the creation succeeds (first run)

eda/drivers/sqlite/EDASQLite.ec

index ff4b48d..c4a4392 100644 (file)
@@ -118,18 +118,18 @@ class SQLiteDataSource : DirFilesDataSourceDriver
             bool success = true;
             char command[1024];
             sprintf(command, "CREATE TABLE eda_table_fields(Table_Name TEXT, Name TEXT, Type TEXT, Length INT);");
-            if(sqlite3_exec(db, command, null, null, null))
+            sqlite3_exec(db, command, null, null, null);
+
+            if(createOptions != readOnly)
             {
-               if(createOptions != readOnly)
-               {
-                  sqlite3_exec(db, "PRAGMA locking_mode=exclusive", null, null, null);
+               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;
+               else
                   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;
-                  else
-                     sqlite3_exec(db, "DELETE FROM eda_table_fields WHERE Name = 'lockDummy'", null, null, null);
-               }
             }
+
             if(success)
                result = SQLiteDatabase { db = db };
          }