# HG changeset patch # User Sebastien Jodogne # Date 1417792938 -3600 # Node ID 92c6b3b576998ba52265d12fde1f5ad07f7e2357 # Parent 6c07108ff1e23985a49a9601586fb8462502968c cleaning diff -r 6c07108ff1e2 -r 92c6b3b57699 OrthancServer/DatabaseWrapper.cpp --- a/OrthancServer/DatabaseWrapper.cpp Fri Dec 05 16:14:57 2014 +0100 +++ b/OrthancServer/DatabaseWrapper.cpp Fri Dec 05 16:22:18 2014 +0100 @@ -213,20 +213,6 @@ } } - std::string DatabaseWrapper::GetGlobalProperty(GlobalProperty property, - const std::string& defaultValue) - { - std::string s; - if (LookupGlobalProperty(s, property)) - { - return s; - } - else - { - return defaultValue; - } - } - int64_t DatabaseWrapper::CreateResource(const std::string& publicId, ResourceType type) { @@ -874,7 +860,12 @@ } // Check the version of the database - std::string version = GetGlobalProperty(GlobalProperty_DatabaseSchemaVersion, "Unknown"); + std::string version; + if (!LookupGlobalProperty(version, GlobalProperty_DatabaseSchemaVersion)) + { + version = "Unknown"; + } + bool ok = false; try { diff -r 6c07108ff1e2 -r 92c6b3b57699 OrthancServer/DatabaseWrapper.h --- a/OrthancServer/DatabaseWrapper.h Fri Dec 05 16:14:57 2014 +0100 +++ b/OrthancServer/DatabaseWrapper.h Fri Dec 05 16:22:18 2014 +0100 @@ -79,9 +79,6 @@ bool LookupGlobalProperty(std::string& target, GlobalProperty property); - std::string GetGlobalProperty(GlobalProperty property, - const std::string& defaultValue); - int64_t CreateResource(const std::string& publicId, ResourceType type); diff -r 6c07108ff1e2 -r 92c6b3b57699 OrthancServer/ServerIndex.cpp --- a/OrthancServer/ServerIndex.cpp Fri Dec 05 16:14:57 2014 +0100 +++ b/OrthancServer/ServerIndex.cpp Fri Dec 05 16:22:18 2014 +0100 @@ -345,9 +345,10 @@ try { boost::mutex::scoped_lock lock(that->mutex_); - std::string sleepString = that->db_->GetGlobalProperty(GlobalProperty_FlushSleep, ""); + std::string sleepString; - if (Toolbox::IsInteger(sleepString)) + if (that->db_->LookupGlobalProperty(sleepString, GlobalProperty_FlushSleep) && + Toolbox::IsInteger(sleepString)) { sleep = boost::lexical_cast(sleepString); } @@ -1917,7 +1918,16 @@ const std::string& defaultValue) { boost::mutex::scoped_lock lock(mutex_); - return db_->GetGlobalProperty(property, defaultValue); + + std::string value; + if (db_->LookupGlobalProperty(value, property)) + { + return value; + } + else + { + return defaultValue; + } } } diff -r 6c07108ff1e2 -r 92c6b3b57699 UnitTestsSources/ServerIndexTests.cpp --- a/UnitTestsSources/ServerIndexTests.cpp Fri Dec 05 16:14:57 2014 +0100 +++ b/UnitTestsSources/ServerIndexTests.cpp Fri Dec 05 16:22:18 2014 +0100 @@ -277,8 +277,6 @@ 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("None", index_->GetGlobalProperty(static_cast(42), "None")); FileInfo att; ASSERT_TRUE(index_->LookupAttachment(att, a[4], FileContentType_DicomAsJson));