comparison OrthancServer/Sources/Database/SQLiteDatabaseWrapper.h @ 4594:d494b4f1103e db-changes

removed the global database mutex from ServerIndex and StatelessDatabaseOperations
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 16 Mar 2021 12:43:43 +0100
parents ff8170d17d90
children 5fabef29c4ff
comparison
equal deleted inserted replaced
4593:60a860942c5e 4594:d494b4f1103e
35 35
36 #include "IDatabaseWrapper.h" 36 #include "IDatabaseWrapper.h"
37 37
38 #include "../../../OrthancFramework/Sources/SQLite/Connection.h" 38 #include "../../../OrthancFramework/Sources/SQLite/Connection.h"
39 39
40 #include <boost/thread/mutex.hpp>
41
40 namespace Orthanc 42 namespace Orthanc
41 { 43 {
42 /** 44 /**
43 * This class manages an instance of the Orthanc SQLite database. It 45 * This class manages an instance of the Orthanc SQLite database. It
44 * translates low-level requests into SQL statements. Mutual 46 * translates low-level requests into SQL statements. Mutual
53 class SignalRemainingAncestor; 55 class SignalRemainingAncestor;
54 class ReadOnlyTransaction; 56 class ReadOnlyTransaction;
55 class ReadWriteTransaction; 57 class ReadWriteTransaction;
56 class LookupFormatter; 58 class LookupFormatter;
57 59
58 SQLite::Connection db_; 60 boost::mutex mutex_;
59 TransactionBase* activeTransaction_; 61 SQLite::Connection db_;
60 SignalRemainingAncestor* signalRemainingAncestor_; 62 TransactionBase* activeTransaction_;
61 unsigned int version_; 63 SignalRemainingAncestor* signalRemainingAncestor_;
64 unsigned int version_;
62 65
63 void GetChangesInternal(std::list<ServerIndexChange>& target, 66 void GetChangesInternal(std::list<ServerIndexChange>& target,
64 bool& done, 67 bool& done,
65 SQLite::Statement& s, 68 SQLite::Statement& s,
66 uint32_t maxResults); 69 uint32_t maxResults);
77 80
78 virtual ~SQLiteDatabaseWrapper(); 81 virtual ~SQLiteDatabaseWrapper();
79 82
80 virtual void Open() ORTHANC_OVERRIDE; 83 virtual void Open() ORTHANC_OVERRIDE;
81 84
82 virtual void Close() ORTHANC_OVERRIDE 85 virtual void Close() ORTHANC_OVERRIDE;
83 {
84 db_.Close();
85 }
86 86
87 virtual IDatabaseWrapper::ITransaction* StartTransaction(TransactionType type, 87 virtual IDatabaseWrapper::ITransaction* StartTransaction(TransactionType type,
88 IDatabaseListener& listener) 88 IDatabaseListener& listener)
89 ORTHANC_OVERRIDE; 89 ORTHANC_OVERRIDE;
90 90
91 virtual void FlushToDisk() ORTHANC_OVERRIDE 91 virtual void FlushToDisk() ORTHANC_OVERRIDE;
92 {
93 db_.FlushToDisk();
94 }
95 92
96 virtual bool HasFlushToDisk() const ORTHANC_OVERRIDE 93 virtual bool HasFlushToDisk() const ORTHANC_OVERRIDE
97 { 94 {
98 return true; 95 return true;
99 } 96 }