Mercurial > hg > orthanc
comparison OrthancServer/SQLiteDatabaseWrapper.h @ 3050:d8a91acb7424 db-changes
working on a database compatibility layer
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Thu, 20 Dec 2018 16:42:35 +0100 |
parents | 53d583d2c775 |
children | 6c5d4281da4a |
comparison
equal
deleted
inserted
replaced
3049:6a2c7e206ebb | 3050:d8a91acb7424 |
---|---|
74 public: | 74 public: |
75 SQLiteDatabaseWrapper(const std::string& path); | 75 SQLiteDatabaseWrapper(const std::string& path); |
76 | 76 |
77 SQLiteDatabaseWrapper(); | 77 SQLiteDatabaseWrapper(); |
78 | 78 |
79 virtual void Open(); | 79 virtual void Open() |
80 ORTHANC_OVERRIDE; | |
80 | 81 |
81 virtual void Close() | 82 virtual void Close() |
83 ORTHANC_OVERRIDE | |
82 { | 84 { |
83 db_.Close(); | 85 db_.Close(); |
84 } | 86 } |
85 | 87 |
86 virtual void SetListener(IDatabaseListener& listener); | 88 virtual void SetListener(IDatabaseListener& listener) |
89 ORTHANC_OVERRIDE; | |
87 | 90 |
88 virtual bool LookupParent(int64_t& parentId, | 91 virtual bool LookupParent(int64_t& parentId, |
89 int64_t resourceId); | 92 int64_t resourceId) |
90 | 93 ORTHANC_OVERRIDE; |
91 virtual std::string GetPublicId(int64_t resourceId); | 94 |
92 | 95 virtual std::string GetPublicId(int64_t resourceId) |
93 virtual ResourceType GetResourceType(int64_t resourceId); | 96 ORTHANC_OVERRIDE; |
94 | 97 |
95 virtual void DeleteResource(int64_t id); | 98 virtual ResourceType GetResourceType(int64_t resourceId) |
99 ORTHANC_OVERRIDE; | |
100 | |
101 virtual void DeleteResource(int64_t id) | |
102 ORTHANC_OVERRIDE; | |
96 | 103 |
97 virtual void GetChanges(std::list<ServerIndexChange>& target /*out*/, | 104 virtual void GetChanges(std::list<ServerIndexChange>& target /*out*/, |
98 bool& done /*out*/, | 105 bool& done /*out*/, |
99 int64_t since, | 106 int64_t since, |
100 uint32_t maxResults); | 107 uint32_t maxResults) |
101 | 108 ORTHANC_OVERRIDE; |
102 virtual void GetLastChange(std::list<ServerIndexChange>& target /*out*/); | 109 |
103 | 110 virtual void GetLastChange(std::list<ServerIndexChange>& target /*out*/) |
104 virtual IDatabaseWrapper::ITransaction* StartTransaction(); | 111 ORTHANC_OVERRIDE; |
112 | |
113 virtual IDatabaseWrapper::ITransaction* StartTransaction() | |
114 ORTHANC_OVERRIDE; | |
105 | 115 |
106 virtual void FlushToDisk() | 116 virtual void FlushToDisk() |
117 ORTHANC_OVERRIDE | |
107 { | 118 { |
108 db_.FlushToDisk(); | 119 db_.FlushToDisk(); |
109 } | 120 } |
110 | 121 |
111 virtual bool HasFlushToDisk() const | 122 virtual bool HasFlushToDisk() const |
123 ORTHANC_OVERRIDE | |
112 { | 124 { |
113 return true; | 125 return true; |
114 } | 126 } |
115 | 127 |
116 virtual void ClearChanges() | 128 virtual void ClearChanges() |
129 ORTHANC_OVERRIDE | |
117 { | 130 { |
118 ClearTable("Changes"); | 131 ClearTable("Changes"); |
119 } | 132 } |
120 | 133 |
121 virtual void ClearExportedResources() | 134 virtual void ClearExportedResources() |
135 ORTHANC_OVERRIDE | |
122 { | 136 { |
123 ClearTable("ExportedResources"); | 137 ClearTable("ExportedResources"); |
124 } | 138 } |
125 | 139 |
126 virtual void GetAllMetadata(std::map<MetadataType, std::string>& target, | 140 virtual void GetAllMetadata(std::map<MetadataType, std::string>& target, |
127 int64_t id); | 141 int64_t id) |
142 ORTHANC_OVERRIDE; | |
128 | 143 |
129 virtual unsigned int GetDatabaseVersion() | 144 virtual unsigned int GetDatabaseVersion() |
145 ORTHANC_OVERRIDE | |
130 { | 146 { |
131 return version_; | 147 return version_; |
132 } | 148 } |
133 | 149 |
134 virtual void Upgrade(unsigned int targetVersion, | 150 virtual void Upgrade(unsigned int targetVersion, |
135 IStorageArea& storageArea); | 151 IStorageArea& storageArea) |
152 ORTHANC_OVERRIDE; | |
136 | 153 |
137 | 154 |
138 /** | 155 /** |
139 * The methods declared below are for unit testing only! | 156 * The methods declared below are for unit testing only! |
140 **/ | 157 **/ |
159 * "DatabaseWrapperBase" class, that is now placed in the | 176 * "DatabaseWrapperBase" class, that is now placed in the |
160 * graveyard. | 177 * graveyard. |
161 **/ | 178 **/ |
162 | 179 |
163 virtual void SetGlobalProperty(GlobalProperty property, | 180 virtual void SetGlobalProperty(GlobalProperty property, |
164 const std::string& value); | 181 const std::string& value) |
182 ORTHANC_OVERRIDE; | |
165 | 183 |
166 virtual bool LookupGlobalProperty(std::string& target, | 184 virtual bool LookupGlobalProperty(std::string& target, |
167 GlobalProperty property); | 185 GlobalProperty property) |
186 ORTHANC_OVERRIDE; | |
168 | 187 |
169 virtual int64_t CreateResource(const std::string& publicId, | 188 virtual int64_t CreateResource(const std::string& publicId, |
170 ResourceType type); | 189 ResourceType type) |
190 ORTHANC_OVERRIDE; | |
171 | 191 |
172 virtual bool LookupResource(int64_t& id, | 192 virtual bool LookupResource(int64_t& id, |
173 ResourceType& type, | 193 ResourceType& type, |
174 const std::string& publicId); | 194 const std::string& publicId) |
195 ORTHANC_OVERRIDE; | |
175 | 196 |
176 virtual void AttachChild(int64_t parent, | 197 virtual void AttachChild(int64_t parent, |
177 int64_t child); | 198 int64_t child) |
199 ORTHANC_OVERRIDE; | |
178 | 200 |
179 virtual void SetMetadata(int64_t id, | 201 virtual void SetMetadata(int64_t id, |
180 MetadataType type, | 202 MetadataType type, |
181 const std::string& value); | 203 const std::string& value) |
204 ORTHANC_OVERRIDE; | |
182 | 205 |
183 virtual void DeleteMetadata(int64_t id, | 206 virtual void DeleteMetadata(int64_t id, |
184 MetadataType type); | 207 MetadataType type) |
208 ORTHANC_OVERRIDE; | |
185 | 209 |
186 virtual bool LookupMetadata(std::string& target, | 210 virtual bool LookupMetadata(std::string& target, |
187 int64_t id, | 211 int64_t id, |
188 MetadataType type); | 212 MetadataType type) |
213 ORTHANC_OVERRIDE; | |
189 | 214 |
190 virtual void ListAvailableMetadata(std::list<MetadataType>& target, | 215 virtual void ListAvailableMetadata(std::list<MetadataType>& target, |
191 int64_t id); | 216 int64_t id) |
217 ORTHANC_OVERRIDE; | |
192 | 218 |
193 virtual void AddAttachment(int64_t id, | 219 virtual void AddAttachment(int64_t id, |
194 const FileInfo& attachment); | 220 const FileInfo& attachment) |
221 ORTHANC_OVERRIDE; | |
195 | 222 |
196 virtual void DeleteAttachment(int64_t id, | 223 virtual void DeleteAttachment(int64_t id, |
197 FileContentType attachment); | 224 FileContentType attachment) |
225 ORTHANC_OVERRIDE; | |
198 | 226 |
199 virtual void ListAvailableAttachments(std::list<FileContentType>& target, | 227 virtual void ListAvailableAttachments(std::list<FileContentType>& target, |
200 int64_t id); | 228 int64_t id) |
229 ORTHANC_OVERRIDE; | |
201 | 230 |
202 virtual bool LookupAttachment(FileInfo& attachment, | 231 virtual bool LookupAttachment(FileInfo& attachment, |
203 int64_t id, | 232 int64_t id, |
204 FileContentType contentType); | 233 FileContentType contentType) |
205 | 234 ORTHANC_OVERRIDE; |
206 virtual void ClearMainDicomTags(int64_t id); | 235 |
236 virtual void ClearMainDicomTags(int64_t id) | |
237 ORTHANC_OVERRIDE; | |
207 | 238 |
208 virtual void SetMainDicomTag(int64_t id, | 239 virtual void SetMainDicomTag(int64_t id, |
209 const DicomTag& tag, | 240 const DicomTag& tag, |
210 const std::string& value); | 241 const std::string& value) |
242 ORTHANC_OVERRIDE; | |
211 | 243 |
212 virtual void SetIdentifierTag(int64_t id, | 244 virtual void SetIdentifierTag(int64_t id, |
213 const DicomTag& tag, | 245 const DicomTag& tag, |
214 const std::string& value); | 246 const std::string& value) |
247 ORTHANC_OVERRIDE; | |
215 | 248 |
216 virtual void GetMainDicomTags(DicomMap& map, | 249 virtual void GetMainDicomTags(DicomMap& map, |
217 int64_t id); | 250 int64_t id) |
251 ORTHANC_OVERRIDE; | |
218 | 252 |
219 virtual void GetChildrenPublicId(std::list<std::string>& target, | 253 virtual void GetChildrenPublicId(std::list<std::string>& target, |
220 int64_t id); | 254 int64_t id) |
255 ORTHANC_OVERRIDE; | |
221 | 256 |
222 virtual void GetChildrenInternalId(std::list<int64_t>& target, | 257 virtual void GetChildrenInternalId(std::list<int64_t>& target, |
223 int64_t id); | 258 int64_t id) |
259 ORTHANC_OVERRIDE; | |
224 | 260 |
225 virtual void LogChange(int64_t internalId, | 261 virtual void LogChange(int64_t internalId, |
226 const ServerIndexChange& change); | 262 const ServerIndexChange& change) |
227 | 263 ORTHANC_OVERRIDE; |
228 virtual void LogExportedResource(const ExportedResource& resource); | 264 |
265 virtual void LogExportedResource(const ExportedResource& resource) | |
266 ORTHANC_OVERRIDE; | |
229 | 267 |
230 virtual void GetExportedResources(std::list<ExportedResource>& target /*out*/, | 268 virtual void GetExportedResources(std::list<ExportedResource>& target /*out*/, |
231 bool& done /*out*/, | 269 bool& done /*out*/, |
232 int64_t since, | 270 int64_t since, |
233 uint32_t maxResults); | 271 uint32_t maxResults) |
234 | 272 ORTHANC_OVERRIDE; |
235 virtual void GetLastExportedResource(std::list<ExportedResource>& target /*out*/); | 273 |
236 | 274 virtual void GetLastExportedResource(std::list<ExportedResource>& target /*out*/) |
237 virtual uint64_t GetTotalCompressedSize(); | 275 ORTHANC_OVERRIDE; |
276 | |
277 virtual uint64_t GetTotalCompressedSize() | |
278 ORTHANC_OVERRIDE; | |
238 | 279 |
239 virtual uint64_t GetTotalUncompressedSize(); | 280 virtual uint64_t GetTotalUncompressedSize() |
240 | 281 ORTHANC_OVERRIDE; |
241 virtual uint64_t GetResourceCount(ResourceType resourceType); | 282 |
283 virtual uint64_t GetResourceCount(ResourceType resourceType) | |
284 ORTHANC_OVERRIDE; | |
242 | 285 |
243 virtual void GetAllInternalIds(std::list<int64_t>& target, | 286 virtual void GetAllInternalIds(std::list<int64_t>& target, |
244 ResourceType resourceType); | 287 ResourceType resourceType) |
288 ORTHANC_OVERRIDE; | |
245 | 289 |
246 virtual void GetAllPublicIds(std::list<std::string>& target, | 290 virtual void GetAllPublicIds(std::list<std::string>& target, |
247 ResourceType resourceType); | 291 ResourceType resourceType) |
292 ORTHANC_OVERRIDE; | |
248 | 293 |
249 virtual void GetAllPublicIds(std::list<std::string>& target, | 294 virtual void GetAllPublicIds(std::list<std::string>& target, |
250 ResourceType resourceType, | 295 ResourceType resourceType, |
251 size_t since, | 296 size_t since, |
252 size_t limit); | 297 size_t limit) |
253 | 298 ORTHANC_OVERRIDE; |
254 virtual bool SelectPatientToRecycle(int64_t& internalId); | 299 |
300 virtual bool SelectPatientToRecycle(int64_t& internalId) | |
301 ORTHANC_OVERRIDE; | |
255 | 302 |
256 virtual bool SelectPatientToRecycle(int64_t& internalId, | 303 virtual bool SelectPatientToRecycle(int64_t& internalId, |
257 int64_t patientIdToAvoid); | 304 int64_t patientIdToAvoid) |
258 | 305 ORTHANC_OVERRIDE; |
259 virtual bool IsProtectedPatient(int64_t internalId); | 306 |
307 virtual bool IsProtectedPatient(int64_t internalId) | |
308 ORTHANC_OVERRIDE; | |
260 | 309 |
261 virtual void SetProtectedPatient(int64_t internalId, | 310 virtual void SetProtectedPatient(int64_t internalId, |
262 bool isProtected); | 311 bool isProtected) |
263 | 312 ORTHANC_OVERRIDE; |
264 virtual bool IsExistingResource(int64_t internalId); | 313 |
265 | 314 virtual bool IsExistingResource(int64_t internalId) |
266 virtual bool IsDiskSizeAbove(uint64_t threshold); | 315 ORTHANC_OVERRIDE; |
316 | |
317 virtual bool IsDiskSizeAbove(uint64_t threshold) | |
318 ORTHANC_OVERRIDE; | |
267 | 319 |
268 virtual void ApplyLookupResources(std::vector<std::string>& resourcesId, | 320 virtual void ApplyLookupResources(std::vector<std::string>& resourcesId, |
269 std::vector<std::string>* instancesId, | 321 std::vector<std::string>* instancesId, |
270 const std::vector<DatabaseConstraint>& lookup, | 322 const std::vector<DatabaseConstraint>& lookup, |
271 ResourceType queryLevel, | 323 ResourceType queryLevel, |
272 size_t limit); | 324 size_t limit) |
325 ORTHANC_OVERRIDE; | |
273 }; | 326 }; |
274 } | 327 } |