Mercurial > hg > orthanc
comparison OrthancServer/Sources/Database/SQLiteDatabaseWrapper.h @ 5807:8279eaab0d1d attach-custom-data
merged default -> attach-custom-data
author | Alain Mazy <am@orthanc.team> |
---|---|
date | Tue, 24 Sep 2024 11:39:52 +0200 |
parents | 9770d537880d f7adfb22e20e |
children | 023a99146dd0 |
comparison
equal
deleted
inserted
replaced
5085:79f98ee4f04b | 5807:8279eaab0d1d |
---|---|
1 /** | 1 /** |
2 * Orthanc - A Lightweight, RESTful DICOM Store | 2 * Orthanc - A Lightweight, RESTful DICOM Store |
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics | 3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics |
4 * Department, University Hospital of Liege, Belgium | 4 * Department, University Hospital of Liege, Belgium |
5 * Copyright (C) 2017-2022 Osimis S.A., Belgium | 5 * Copyright (C) 2017-2023 Osimis S.A., Belgium |
6 * Copyright (C) 2021-2022 Sebastien Jodogne, ICTEAM UCLouvain, Belgium | 6 * Copyright (C) 2024-2024 Orthanc Team SRL, Belgium |
7 * Copyright (C) 2021-2024 Sebastien Jodogne, ICTEAM UCLouvain, Belgium | |
7 * | 8 * |
8 * This program is free software: you can redistribute it and/or | 9 * This program is free software: you can redistribute it and/or |
9 * modify it under the terms of the GNU General Public License as | 10 * modify it under the terms of the GNU General Public License as |
10 * published by the Free Software Foundation, either version 3 of the | 11 * published by the Free Software Foundation, either version 3 of the |
11 * License, or (at your option) any later version. | 12 * License, or (at your option) any later version. |
20 **/ | 21 **/ |
21 | 22 |
22 | 23 |
23 #pragma once | 24 #pragma once |
24 | 25 |
25 #include "IDatabaseWrapper.h" | 26 #include "BaseDatabaseWrapper.h" |
26 | 27 |
27 #include "../../../OrthancFramework/Sources/SQLite/Connection.h" | 28 #include "../../../OrthancFramework/Sources/SQLite/Connection.h" |
28 | 29 |
29 #include <boost/thread/mutex.hpp> | 30 #include <boost/thread/mutex.hpp> |
30 | 31 |
33 /** | 34 /** |
34 * This class manages an instance of the Orthanc SQLite database. It | 35 * This class manages an instance of the Orthanc SQLite database. It |
35 * translates low-level requests into SQL statements. Mutual | 36 * translates low-level requests into SQL statements. Mutual |
36 * exclusion MUST be implemented at a higher level. | 37 * exclusion MUST be implemented at a higher level. |
37 **/ | 38 **/ |
38 class SQLiteDatabaseWrapper : public IDatabaseWrapper | 39 class SQLiteDatabaseWrapper : public BaseDatabaseWrapper |
39 { | 40 { |
40 private: | 41 private: |
41 class TransactionBase; | 42 class TransactionBase; |
42 class SignalFileDeleted; | 43 class SignalFileDeleted; |
43 class SignalResourceDeleted; | 44 class SignalResourceDeleted; |
49 boost::mutex mutex_; | 50 boost::mutex mutex_; |
50 SQLite::Connection db_; | 51 SQLite::Connection db_; |
51 TransactionBase* activeTransaction_; | 52 TransactionBase* activeTransaction_; |
52 SignalRemainingAncestor* signalRemainingAncestor_; | 53 SignalRemainingAncestor* signalRemainingAncestor_; |
53 unsigned int version_; | 54 unsigned int version_; |
55 IDatabaseWrapper::Capabilities dbCapabilities_; | |
54 | 56 |
55 void GetChangesInternal(std::list<ServerIndexChange>& target, | 57 void GetChangesInternal(std::list<ServerIndexChange>& target, |
56 bool& done, | 58 bool& done, |
57 SQLite::Statement& s, | 59 SQLite::Statement& s, |
58 uint32_t maxResults); | 60 uint32_t maxResults); |
77 IDatabaseListener& listener) | 79 IDatabaseListener& listener) |
78 ORTHANC_OVERRIDE; | 80 ORTHANC_OVERRIDE; |
79 | 81 |
80 virtual void FlushToDisk() ORTHANC_OVERRIDE; | 82 virtual void FlushToDisk() ORTHANC_OVERRIDE; |
81 | 83 |
82 virtual bool HasFlushToDisk() const ORTHANC_OVERRIDE | |
83 { | |
84 return true; | |
85 } | |
86 | |
87 virtual unsigned int GetDatabaseVersion() ORTHANC_OVERRIDE | 84 virtual unsigned int GetDatabaseVersion() ORTHANC_OVERRIDE |
88 { | 85 { |
89 return version_; | 86 return version_; |
90 } | 87 } |
91 | 88 |
92 virtual void Upgrade(unsigned int targetVersion, | 89 virtual void Upgrade(unsigned int targetVersion, |
93 IStorageArea& storageArea) ORTHANC_OVERRIDE; | 90 IStorageArea& storageArea) ORTHANC_OVERRIDE; |
94 | 91 |
95 virtual bool HasRevisionsSupport() const ORTHANC_OVERRIDE | 92 virtual const Capabilities GetDatabaseCapabilities() const ORTHANC_OVERRIDE |
96 { | 93 { |
97 return true; | 94 return dbCapabilities_; |
98 } | 95 } |
99 | 96 |
100 virtual bool HasAttachmentCustomDataSupport() const ORTHANC_OVERRIDE | 97 virtual uint64_t MeasureLatency() ORTHANC_OVERRIDE |
101 { | 98 { |
102 return true; | 99 throw OrthancException(ErrorCode_NotImplemented); |
103 } | 100 } |
104 | 101 |
105 /** | 102 /** |
106 * The "StartTransaction()" method is guaranteed to return a class | 103 * The "StartTransaction()" method is guaranteed to return a class |
107 * derived from "UnitTestsTransaction". The methods of | 104 * derived from "UnitTestsTransaction". The methods of |
108 * "UnitTestsTransaction" give access to additional information | 105 * "UnitTestsTransaction" give access to additional information |
109 * about the underlying SQLite database to be used in unit tests. | 106 * about the underlying SQLite database to be used in unit tests. |
110 **/ | 107 **/ |
111 class UnitTestsTransaction : public ITransaction | 108 class UnitTestsTransaction : public BaseDatabaseWrapper::BaseTransaction |
112 { | 109 { |
113 protected: | 110 protected: |
114 SQLite::Connection& db_; | 111 SQLite::Connection& db_; |
115 | 112 |
116 public: | 113 public: |