Mercurial > hg > orthanc-databases
comparison Framework/Plugins/IndexBackend.cpp @ 568:77c8544bbd7d find-refactoring
merge
author | Alain Mazy <am@orthanc.team> |
---|---|
date | Mon, 23 Sep 2024 16:06:53 +0200 |
parents | 22bbce1f88ff a7f841fc4a9f |
children | f18e46d7dbf8 35d2df9572b1 |
comparison
equal
deleted
inserted
replaced
567:22bbce1f88ff | 568:77c8544bbd7d |
---|---|
123 } | 123 } |
124 } | 124 } |
125 } | 125 } |
126 | 126 |
127 | 127 |
128 namespace // Anonymous namespace to avoid clashes between compilation modules | |
129 { | |
130 struct Change | |
131 { | |
132 int64_t seq_; | |
133 int32_t changeType_; | |
134 OrthancPluginResourceType resourceType_; | |
135 std::string publicId_; | |
136 std::string changeDate_; | |
137 | |
138 Change(int64_t seq, int32_t changeType, OrthancPluginResourceType resourceType, const std::string& publicId, const std::string& changeDate) | |
139 : seq_(seq), changeType_(changeType), resourceType_(resourceType), publicId_(publicId), changeDate_(changeDate) | |
140 { | |
141 } | |
142 }; | |
143 } | |
144 | |
145 | |
128 void IndexBackend::ReadChangesInternal(IDatabaseBackendOutput& output, | 146 void IndexBackend::ReadChangesInternal(IDatabaseBackendOutput& output, |
129 bool& done, | 147 bool& done, |
130 DatabaseManager& manager, | 148 DatabaseManager& manager, |
131 DatabaseManager::CachedStatement& statement, | 149 DatabaseManager::CachedStatement& statement, |
132 const Dictionary& args, | 150 const Dictionary& args, |
133 uint32_t limit, | 151 uint32_t limit, |
134 bool returnFirstResults) | 152 bool returnFirstResults) |
135 { | 153 { |
136 struct Change | |
137 { | |
138 int64_t seq_; | |
139 int32_t changeType_; | |
140 OrthancPluginResourceType resourceType_; | |
141 std::string publicId_; | |
142 std::string changeDate_; | |
143 | |
144 Change(int64_t seq, int32_t changeType, OrthancPluginResourceType resourceType, const std::string& publicId, const std::string& changeDate) | |
145 : seq_(seq), changeType_(changeType), resourceType_(resourceType), publicId_(publicId), changeDate_(changeDate) | |
146 { | |
147 } | |
148 }; | |
149 | |
150 statement.Execute(args); | 154 statement.Execute(args); |
151 | 155 |
152 std::list<Change> changes; | 156 std::list<Change> changes; |
153 while (!statement.IsDone()) | 157 while (!statement.IsDone()) |
154 { | 158 { |
645 if (to != -1) | 649 if (to != -1) |
646 { | 650 { |
647 hasTo = true; | 651 hasTo = true; |
648 filters.push_back("seq<=${to}"); | 652 filters.push_back("seq<=${to}"); |
649 } | 653 } |
654 #if ORTHANC_PLUGINS_HAS_CHANGES_EXTENDED == 1 | |
650 if (changeTypes.size() > 0) | 655 if (changeTypes.size() > 0) |
651 { | 656 { |
652 filters.push_back("changeType IN (" + JoinChanges(changeTypes) + ") "); | 657 filters.push_back("changeType IN (" + JoinChanges(changeTypes) + ") "); |
653 } | 658 } |
659 #endif | |
654 | 660 |
655 std::string filtersString; | 661 std::string filtersString; |
656 if (filters.size() > 0) | 662 if (filters.size() > 0) |
657 { | 663 { |
658 Orthanc::Toolbox::JoinStrings(filtersString, filters, " AND "); | 664 Orthanc::Toolbox::JoinStrings(filtersString, filters, " AND "); |