# HG changeset patch # User Sebastien Jodogne # Date 1415285893 -3600 # Node ID efece308018e2715d4da5435362acc22009c2cc5 # Parent 92ba9c7b431fa40fddfa58964915e24dcb8a88c4 report database version in /system diff -r 92ba9c7b431f -r efece308018e OrthancServer/DatabaseWrapper.h --- a/OrthancServer/DatabaseWrapper.h Tue Nov 04 16:09:35 2014 +0100 +++ b/OrthancServer/DatabaseWrapper.h Thu Nov 06 15:58:13 2014 +0100 @@ -80,7 +80,7 @@ GlobalProperty property); std::string GetGlobalProperty(GlobalProperty property, - const std::string& defaultValue = ""); + const std::string& defaultValue); int64_t CreateResource(const std::string& publicId, ResourceType type); diff -r 92ba9c7b431f -r efece308018e OrthancServer/OrthancRestApi/OrthancRestSystem.cpp --- a/OrthancServer/OrthancRestApi/OrthancRestSystem.cpp Tue Nov 04 16:09:35 2014 +0100 +++ b/OrthancServer/OrthancRestApi/OrthancRestSystem.cpp Thu Nov 06 15:58:13 2014 +0100 @@ -54,6 +54,7 @@ result["Version"] = ORTHANC_VERSION; result["Name"] = Configuration::GetGlobalStringParameter("Name", ""); + result["DatabaseVersion"] = boost::lexical_cast(OrthancRestApi::GetIndex(call).GetGlobalProperty(GlobalProperty_DatabaseSchemaVersion, "0")); call.GetOutput().AnswerJson(result); } diff -r 92ba9c7b431f -r efece308018e OrthancServer/ServerIndex.cpp --- a/OrthancServer/ServerIndex.cpp Tue Nov 04 16:09:35 2014 +0100 +++ b/OrthancServer/ServerIndex.cpp Thu Nov 06 15:58:13 2014 +0100 @@ -346,7 +346,7 @@ try { boost::mutex::scoped_lock lock(that->mutex_); - std::string sleepString = that->db_->GetGlobalProperty(GlobalProperty_FlushSleep); + std::string sleepString = that->db_->GetGlobalProperty(GlobalProperty_FlushSleep, ""); if (Toolbox::IsInteger(sleepString)) { @@ -1859,4 +1859,13 @@ return true; } + + + std::string ServerIndex::GetGlobalProperty(GlobalProperty property, + const std::string& defaultValue) + { + boost::mutex::scoped_lock lock(mutex_); + return db_->GetGlobalProperty(property, defaultValue); + } + } diff -r 92ba9c7b431f -r efece308018e OrthancServer/ServerIndex.h --- a/OrthancServer/ServerIndex.h Tue Nov 04 16:09:35 2014 +0100 +++ b/OrthancServer/ServerIndex.h Thu Nov 06 15:58:13 2014 +0100 @@ -234,5 +234,8 @@ void DeleteAttachment(const std::string& publicId, FileContentType type); + + std::string GetGlobalProperty(GlobalProperty property, + const std::string& defaultValue); }; } diff -r 92ba9c7b431f -r efece308018e UnitTestsSources/ServerIndexTests.cpp --- a/UnitTestsSources/ServerIndexTests.cpp Tue Nov 04 16:09:35 2014 +0100 +++ b/UnitTestsSources/ServerIndexTests.cpp Thu Nov 06 15:58:13 2014 +0100 @@ -274,7 +274,7 @@ ASSERT_TRUE(index_->LookupGlobalProperty(s, GlobalProperty_FlushSleep)); ASSERT_FALSE(index_->LookupGlobalProperty(s, static_cast(42))); ASSERT_EQ("World", s); - ASSERT_EQ("World", index_->GetGlobalProperty(GlobalProperty_FlushSleep)); + ASSERT_EQ("World", index_->GetGlobalProperty(GlobalProperty_FlushSleep, "")); ASSERT_EQ("None", index_->GetGlobalProperty(static_cast(42), "None")); FileInfo att;