diff SQLite/Plugins/SQLiteIndex.cpp @ 241:a063bbf10a3e

simplification of class DatabaseManager::Transaction
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 13 Apr 2021 12:07:30 +0200
parents f033cc039264
children d663d9e44f8d
line wrap: on
line diff
--- a/SQLite/Plugins/SQLiteIndex.cpp	Mon Apr 12 17:07:06 2021 +0200
+++ b/SQLite/Plugins/SQLiteIndex.cpp	Tue Apr 13 12:07:30 2021 +0200
@@ -85,14 +85,14 @@
     {
       DatabaseManager::Transaction t(manager, TransactionType_ReadWrite);
 
-      if (!t.DoesTableExist("Resources"))
+      if (!t.GetDatabaseTransaction().DoesTableExist("Resources"))
       {
         std::string query;
 
         Orthanc::EmbeddedResources::GetFileResource
           (query, Orthanc::EmbeddedResources::SQLITE_PREPARE_INDEX);
 
-        t.ExecuteMultiLines(query);
+        t.GetDatabaseTransaction().ExecuteMultiLines(query);
 
         SetGlobalIntegerProperty(manager, MISSING_SERVER_IDENTIFIER, Orthanc::GlobalProperty_DatabaseSchemaVersion, expectedVersion);
         SetGlobalIntegerProperty(manager, MISSING_SERVER_IDENTIFIER, Orthanc::GlobalProperty_DatabasePatchLevel, 1);
@@ -104,7 +104,7 @@
     {
       DatabaseManager::Transaction t(manager, TransactionType_ReadWrite);
 
-      if (!t.DoesTableExist("Resources"))
+      if (!t.GetDatabaseTransaction().DoesTableExist("Resources"))
       {
         LOG(ERROR) << "Corrupted SQLite database";
         throw Orthanc::OrthancException(Orthanc::ErrorCode_InternalError);        
@@ -137,10 +137,10 @@
     {
       DatabaseManager::Transaction t(manager, TransactionType_ReadWrite);
 
-      if (!t.DoesTableExist("ServerProperties"))
+      if (!t.GetDatabaseTransaction().DoesTableExist("ServerProperties"))
       {
-        t.ExecuteMultiLines("CREATE TABLE ServerProperties(server TEXT, "
-                            "property INTEGER, value TEXT, PRIMARY KEY(server, property))");
+        t.GetDatabaseTransaction().ExecuteMultiLines("CREATE TABLE ServerProperties(server TEXT, "
+                                                     "property INTEGER, value TEXT, PRIMARY KEY(server, property))");
       }
 
       t.Commit();