comparison OrthancServer/ServerIndex.cpp @ 3315:8bf33fa68435

Fix missing DB transactions in some write operations
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 28 Feb 2019 18:09:36 +0100
parents 4bbadcd03966
children 94f4a18a79cc
comparison
equal deleted inserted replaced
3314:7eb5405b7ed8 3315:8bf33fa68435
1933 1933
1934 1934
1935 void ServerIndex::DeleteChanges() 1935 void ServerIndex::DeleteChanges()
1936 { 1936 {
1937 boost::mutex::scoped_lock lock(mutex_); 1937 boost::mutex::scoped_lock lock(mutex_);
1938
1939 Transaction transaction(*this);
1938 db_.ClearChanges(); 1940 db_.ClearChanges();
1941 transaction.Commit(0);
1939 } 1942 }
1940 1943
1941 void ServerIndex::DeleteExportedResources() 1944 void ServerIndex::DeleteExportedResources()
1942 { 1945 {
1943 boost::mutex::scoped_lock lock(mutex_); 1946 boost::mutex::scoped_lock lock(mutex_);
1947
1948 Transaction transaction(*this);
1944 db_.ClearExportedResources(); 1949 db_.ClearExportedResources();
1950 transaction.Commit(0);
1945 } 1951 }
1946 1952
1947 1953
1948 void ServerIndex::GetResourceStatistics(/* out */ ResourceType& type, 1954 void ServerIndex::GetResourceStatistics(/* out */ ResourceType& type,
1949 /* out */ uint64_t& diskSize, 1955 /* out */ uint64_t& diskSize,
2233 2239
2234 void ServerIndex::SetGlobalProperty(GlobalProperty property, 2240 void ServerIndex::SetGlobalProperty(GlobalProperty property,
2235 const std::string& value) 2241 const std::string& value)
2236 { 2242 {
2237 boost::mutex::scoped_lock lock(mutex_); 2243 boost::mutex::scoped_lock lock(mutex_);
2244
2245 Transaction transaction(*this);
2238 db_.SetGlobalProperty(property, value); 2246 db_.SetGlobalProperty(property, value);
2247 transaction.Commit(0);
2239 } 2248 }
2240 2249
2241 2250
2242 bool ServerIndex::LookupGlobalProperty(std::string& value, 2251 bool ServerIndex::LookupGlobalProperty(std::string& value,
2243 GlobalProperty property) 2252 GlobalProperty property)