changeset 220:492aa3edf572

use read-only, explicit transaction in IndexBackend::GetDatabaseVersion()
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 29 Mar 2021 16:39:20 +0200
parents dd6cfc250747
children 73cc85f3d9c1
files Framework/Plugins/IndexBackend.cpp
diffstat 1 files changed, 5 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/Framework/Plugins/IndexBackend.cpp	Mon Mar 29 14:52:55 2021 +0200
+++ b/Framework/Plugins/IndexBackend.cpp	Mon Mar 29 16:39:20 2021 +0200
@@ -1439,6 +1439,11 @@
     
   uint32_t IndexBackend::GetDatabaseVersion()
   {
+    // Create a read-only, explicit transaction to read the database
+    // version (this was a read-write, implicit transaction in
+    // PostgreSQL plugin <= 3.3 and MySQL plugin <= 3.0)
+    DatabaseManager::Transaction transaction(GetManager(), TransactionType_ReadOnly);
+    
     std::string version = "unknown";
       
     if (LookupGlobalProperty(version, Orthanc::GlobalProperty_DatabaseSchemaVersion))