comparison Framework/Plugins/IndexBackend.cpp @ 221:73cc85f3d9c1

implementation of the "serverIdentifier" information for global properties
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 30 Mar 2021 10:40:34 +0200
parents 492aa3edf572
children c8e06b41feec
comparison
equal deleted inserted replaced
220:492aa3edf572 221:73cc85f3d9c1
1032 } 1032 }
1033 } 1033 }
1034 1034
1035 1035
1036 bool IndexBackend::LookupGlobalProperty(std::string& target /*out*/, 1036 bool IndexBackend::LookupGlobalProperty(std::string& target /*out*/,
1037 const char* serverIdentifier,
1037 int32_t property) 1038 int32_t property)
1038 { 1039 {
1039 return ::OrthancDatabases::LookupGlobalProperty(target, manager_, static_cast<Orthanc::GlobalProperty>(property)); 1040 return ::OrthancDatabases::LookupGlobalProperty(target, manager_, serverIdentifier,
1041 static_cast<Orthanc::GlobalProperty>(property));
1040 } 1042 }
1041 1043
1042 1044
1043 void IndexBackend::LookupIdentifier(std::list<int64_t>& target /*out*/, 1045 void IndexBackend::LookupIdentifier(std::list<int64_t>& target /*out*/,
1044 OrthancPluginResourceType resourceType, 1046 OrthancPluginResourceType resourceType,
1287 return true; 1289 return true;
1288 } 1290 }
1289 } 1291 }
1290 1292
1291 1293
1292 void IndexBackend::SetGlobalProperty(int32_t property, 1294 void IndexBackend::SetGlobalProperty(const char* serverIdentifier,
1295 int32_t property,
1293 const char* value) 1296 const char* value)
1294 { 1297 {
1295 return ::OrthancDatabases::SetGlobalProperty(manager_, static_cast<Orthanc::GlobalProperty>(property), value); 1298 return ::OrthancDatabases::SetGlobalProperty(
1299 manager_, serverIdentifier, static_cast<Orthanc::GlobalProperty>(property), value);
1296 } 1300 }
1297 1301
1298 1302
1299 static void ExecuteSetTag(DatabaseManager::CachedStatement& statement, 1303 static void ExecuteSetTag(DatabaseManager::CachedStatement& statement,
1300 int64_t id, 1304 int64_t id,
1444 // PostgreSQL plugin <= 3.3 and MySQL plugin <= 3.0) 1448 // PostgreSQL plugin <= 3.3 and MySQL plugin <= 3.0)
1445 DatabaseManager::Transaction transaction(GetManager(), TransactionType_ReadOnly); 1449 DatabaseManager::Transaction transaction(GetManager(), TransactionType_ReadOnly);
1446 1450
1447 std::string version = "unknown"; 1451 std::string version = "unknown";
1448 1452
1449 if (LookupGlobalProperty(version, Orthanc::GlobalProperty_DatabaseSchemaVersion)) 1453 if (LookupGlobalProperty(version, MISSING_SERVER_IDENTIFIER, Orthanc::GlobalProperty_DatabaseSchemaVersion))
1450 { 1454 {
1451 try 1455 try
1452 { 1456 {
1453 return boost::lexical_cast<unsigned int>(version); 1457 return boost::lexical_cast<unsigned int>(version);
1454 } 1458 }