comparison OrthancServer/DatabaseWrapperBase.h @ 1671:2f2e2ec17bc4 db-changes

sample database plugin
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 01 Oct 2015 17:44:43 +0200
parents 16955f8fec4d
children 4c5a85c3ff43
comparison
equal deleted inserted replaced
1670:16955f8fec4d 1671:2f2e2ec17bc4
35 #include "../Core/DicomFormat/DicomMap.h" 35 #include "../Core/DicomFormat/DicomMap.h"
36 #include "../Core/DicomFormat/DicomTag.h" 36 #include "../Core/DicomFormat/DicomTag.h"
37 #include "../Core/Enumerations.h" 37 #include "../Core/Enumerations.h"
38 #include "../Core/FileStorage/FileInfo.h" 38 #include "../Core/FileStorage/FileInfo.h"
39 #include "../Core/SQLite/Connection.h" 39 #include "../Core/SQLite/Connection.h"
40 #include "../OrthancServer/ExportedResource.h"
40 #include "../OrthancServer/ServerIndexChange.h" 41 #include "../OrthancServer/ServerIndexChange.h"
41 #include "../OrthancServer/ExportedResource.h"
42 #include "ServerEnumerations.h" 42 #include "ServerEnumerations.h"
43 43
44 #include <list> 44 #include <list>
45 45
46 46
49 class DatabaseWrapperBase 49 class DatabaseWrapperBase
50 { 50 {
51 private: 51 private:
52 SQLite::Connection& db_; 52 SQLite::Connection& db_;
53 53
54 void GetChangesInternal(std::list<ServerIndexChange>& target, 54 ErrorCode GetChangesInternal(std::list<ServerIndexChange>& target,
55 bool& done, 55 bool& done,
56 SQLite::Statement& s, 56 SQLite::Statement& s,
57 uint32_t maxResults); 57 uint32_t maxResults);
58 58
59 void GetExportedResourcesInternal(std::list<ExportedResource>& target, 59 void GetExportedResourcesInternal(std::list<ExportedResource>& target,
60 bool& done, 60 bool& done,
61 SQLite::Statement& s, 61 SQLite::Statement& s,
62 uint32_t maxResults); 62 uint32_t maxResults);
77 77
78 bool LookupResource(int64_t& id, 78 bool LookupResource(int64_t& id,
79 ResourceType& type, 79 ResourceType& type,
80 const std::string& publicId); 80 const std::string& publicId);
81 81
82 bool LookupParent(int64_t& parentId, 82 ErrorCode LookupParent(bool& found,
83 int64_t resourceId); 83 int64_t& parentId,
84 int64_t resourceId);
84 85
85 std::string GetPublicId(int64_t resourceId); 86 bool GetPublicId(std::string& result,
87 int64_t resourceId);
86 88
87 ResourceType GetResourceType(int64_t resourceId); 89 ErrorCode GetResourceType(ResourceType& result,
90 int64_t resourceId);
88 91
89 void AttachChild(int64_t parent, 92 void AttachChild(int64_t parent,
90 int64_t child); 93 int64_t child);
91 94
92 void SetMetadata(int64_t id, 95 void SetMetadata(int64_t id,
134 int64_t id); 137 int64_t id);
135 138
136 void LogChange(int64_t internalId, 139 void LogChange(int64_t internalId,
137 const ServerIndexChange& change); 140 const ServerIndexChange& change);
138 141
139 void GetChanges(std::list<ServerIndexChange>& target, 142 ErrorCode GetChanges(std::list<ServerIndexChange>& target,
140 bool& done, 143 bool& done,
141 int64_t since, 144 int64_t since,
142 uint32_t maxResults); 145 uint32_t maxResults);
143 146
144 void GetLastChange(std::list<ServerIndexChange>& target); 147 ErrorCode GetLastChange(std::list<ServerIndexChange>& target);
145
146 148
147 void LogExportedResource(const ExportedResource& resource); 149 void LogExportedResource(const ExportedResource& resource);
148 150
149 void GetExportedResources(std::list<ExportedResource>& target, 151 void GetExportedResources(std::list<ExportedResource>& target,
150 bool& done, 152 bool& done,
177 void SetProtectedPatient(int64_t internalId, 179 void SetProtectedPatient(int64_t internalId,
178 bool isProtected); 180 bool isProtected);
179 181
180 bool IsExistingResource(int64_t internalId); 182 bool IsExistingResource(int64_t internalId);
181 183
182
183 void LookupIdentifier(std::list<int64_t>& target, 184 void LookupIdentifier(std::list<int64_t>& target,
184 const DicomTag& tag, 185 const DicomTag& tag,
185 const std::string& value); 186 const std::string& value);
186 187
187 void LookupIdentifier(std::list<int64_t>& target, 188 void LookupIdentifier(std::list<int64_t>& target,