comparison Framework/Plugins/IndexBackend.cpp @ 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
comparison
equal deleted inserted replaced
219:dd6cfc250747 220:492aa3edf572
1437 } 1437 }
1438 1438
1439 1439
1440 uint32_t IndexBackend::GetDatabaseVersion() 1440 uint32_t IndexBackend::GetDatabaseVersion()
1441 { 1441 {
1442 // Create a read-only, explicit transaction to read the database
1443 // version (this was a read-write, implicit transaction in
1444 // PostgreSQL plugin <= 3.3 and MySQL plugin <= 3.0)
1445 DatabaseManager::Transaction transaction(GetManager(), TransactionType_ReadOnly);
1446
1442 std::string version = "unknown"; 1447 std::string version = "unknown";
1443 1448
1444 if (LookupGlobalProperty(version, Orthanc::GlobalProperty_DatabaseSchemaVersion)) 1449 if (LookupGlobalProperty(version, Orthanc::GlobalProperty_DatabaseSchemaVersion))
1445 { 1450 {
1446 try 1451 try