comparison OrthancServer/Sources/Database/SQLiteDatabaseWrapper.h @ 4589:bec74e29f86b db-changes

attaching the listener to transactions in IDatabaseWrapper
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 12 Mar 2021 15:33:47 +0100
parents 648defffc8cc
children ff8170d17d90
comparison
equal deleted inserted replaced
4588:94147ce2f097 4589:bec74e29f86b
41 #include "Compatibility/ILookupResourceAndParent.h" 41 #include "Compatibility/ILookupResourceAndParent.h"
42 #include "Compatibility/ISetResourcesContent.h" 42 #include "Compatibility/ISetResourcesContent.h"
43 43
44 namespace Orthanc 44 namespace Orthanc
45 { 45 {
46 namespace Internals
47 {
48 class SignalRemainingAncestor;
49 }
50
51 /** 46 /**
52 * This class manages an instance of the Orthanc SQLite database. It 47 * This class manages an instance of the Orthanc SQLite database. It
53 * translates low-level requests into SQL statements. Mutual 48 * translates low-level requests into SQL statements. Mutual
54 * exclusion MUST be implemented at a higher level. 49 * exclusion MUST be implemented at a higher level.
55 **/ 50 **/
59 public Compatibility::IGetChildrenMetadata, 54 public Compatibility::IGetChildrenMetadata,
60 public Compatibility::ILookupResourceAndParent, 55 public Compatibility::ILookupResourceAndParent,
61 public Compatibility::ISetResourcesContent 56 public Compatibility::ISetResourcesContent
62 { 57 {
63 private: 58 private:
59 class SignalFileDeleted;
60 class SignalResourceDeleted;
61 class SignalRemainingAncestor;
64 class ReadOnlyTransaction; 62 class ReadOnlyTransaction;
65 class ReadWriteTransaction; 63 class ReadWriteTransaction;
66 class LookupFormatter; 64 class LookupFormatter;
67 65
68 IDatabaseListener* listener_; 66 IDatabaseListener* listener_;
69 SQLite::Connection db_; 67 SQLite::Connection db_;
70 Internals::SignalRemainingAncestor* signalRemainingAncestor_; 68 SignalRemainingAncestor* signalRemainingAncestor_;
71 unsigned int version_; 69 unsigned int version_;
72 70
73 void GetChangesInternal(std::list<ServerIndexChange>& target, 71 void GetChangesInternal(std::list<ServerIndexChange>& target,
74 bool& done, 72 bool& done,
75 SQLite::Statement& s, 73 SQLite::Statement& s,
98 ORTHANC_OVERRIDE 96 ORTHANC_OVERRIDE
99 { 97 {
100 db_.Close(); 98 db_.Close();
101 } 99 }
102 100
103 virtual void SetListener(IDatabaseListener& listener)
104 ORTHANC_OVERRIDE;
105
106 virtual bool LookupParent(int64_t& parentId, 101 virtual bool LookupParent(int64_t& parentId,
107 int64_t resourceId) 102 int64_t resourceId)
108 ORTHANC_OVERRIDE; 103 ORTHANC_OVERRIDE;
109 104
110 virtual std::string GetPublicId(int64_t resourceId) 105 virtual std::string GetPublicId(int64_t resourceId)
123 ORTHANC_OVERRIDE; 118 ORTHANC_OVERRIDE;
124 119
125 virtual void GetLastChange(std::list<ServerIndexChange>& target /*out*/) 120 virtual void GetLastChange(std::list<ServerIndexChange>& target /*out*/)
126 ORTHANC_OVERRIDE; 121 ORTHANC_OVERRIDE;
127 122
128 virtual IDatabaseWrapper::ITransaction* StartTransaction(TransactionType type) 123 virtual IDatabaseWrapper::ITransaction* StartTransaction(TransactionType type,
124 IDatabaseListener& listener)
129 ORTHANC_OVERRIDE; 125 ORTHANC_OVERRIDE;
130 126
131 virtual void FlushToDisk() 127 virtual void FlushToDisk()
132 ORTHANC_OVERRIDE 128 ORTHANC_OVERRIDE
133 { 129 {