Mercurial > hg > orthanc-databases
annotate Resources/Orthanc/Databases/ISqlLookupFormatter.cpp @ 505:38e428f8179d
more detailed error messages
author | Alain Mazy <am@orthanc.team> |
---|---|
date | Fri, 24 May 2024 16:39:38 +0200 |
parents | ecd0b719cff5 |
children | 54d518dcd74a |
rev | line source |
---|---|
152 | 1 /** |
2 * Orthanc - A Lightweight, RESTful DICOM Store | |
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics | |
4 * Department, University Hospital of Liege, Belgium | |
459
ecd0b719cff5
update year to 2024
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
425
diff
changeset
|
5 * Copyright (C) 2017-2024 Osimis S.A., Belgium |
ecd0b719cff5
update year to 2024
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
425
diff
changeset
|
6 * Copyright (C) 2021-2024 Sebastien Jodogne, ICTEAM UCLouvain, Belgium |
152 | 7 * |
8 * 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 * published by the Free Software Foundation, either version 3 of the | |
11 * License, or (at your option) any later version. | |
12 * | |
13 * This program is distributed in the hope that it will be useful, but | |
14 * WITHOUT ANY WARRANTY; without even the implied warranty of | |
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
16 * General Public License for more details. | |
17 * | |
18 * You should have received a copy of the GNU General Public License | |
19 * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
20 **/ | |
21 | |
22 | |
23 #if !defined(ORTHANC_BUILDING_SERVER_LIBRARY) | |
24 # error Macro ORTHANC_BUILDING_SERVER_LIBRARY must be defined | |
25 #endif | |
26 | |
27 #if ORTHANC_BUILDING_SERVER_LIBRARY == 1 | |
28 # include "../PrecompiledHeadersServer.h" | |
29 #endif | |
30 | |
31 #include "ISqlLookupFormatter.h" | |
32 | |
33 #if ORTHANC_BUILDING_SERVER_LIBRARY == 1 | |
34 # include "../../../OrthancFramework/Sources/OrthancException.h" | |
425 | 35 # include "../../../OrthancFramework/Sources/Toolbox.h" |
152 | 36 #else |
37 # include <OrthancException.h> | |
425 | 38 # include <Toolbox.h> |
152 | 39 #endif |
40 | |
41 #include "DatabaseConstraint.h" | |
42 | |
459
ecd0b719cff5
update year to 2024
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
425
diff
changeset
|
43 #include <cassert> |
170 | 44 #include <boost/lexical_cast.hpp> |
405 | 45 #include <list> |
170 | 46 |
47 | |
152 | 48 namespace Orthanc |
49 { | |
50 static std::string FormatLevel(ResourceType level) | |
51 { | |
52 switch (level) | |
53 { | |
54 case ResourceType_Patient: | |
55 return "patients"; | |
56 | |
57 case ResourceType_Study: | |
58 return "studies"; | |
59 | |
60 case ResourceType_Series: | |
61 return "series"; | |
62 | |
63 case ResourceType_Instance: | |
64 return "instances"; | |
65 | |
66 default: | |
67 throw OrthancException(ErrorCode_InternalError); | |
68 } | |
69 } | |
70 | |
71 | |
72 static bool FormatComparison(std::string& target, | |
73 ISqlLookupFormatter& formatter, | |
74 const DatabaseConstraint& constraint, | |
354
2a3bbb4104fa
fix changeset 389c037387ea
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
353
diff
changeset
|
75 size_t index, |
2a3bbb4104fa
fix changeset 389c037387ea
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
353
diff
changeset
|
76 bool escapeBrackets) |
152 | 77 { |
78 std::string tag = "t" + boost::lexical_cast<std::string>(index); | |
79 | |
80 std::string comparison; | |
81 | |
82 switch (constraint.GetConstraintType()) | |
83 { | |
84 case ConstraintType_Equal: | |
85 case ConstraintType_SmallerOrEqual: | |
86 case ConstraintType_GreaterOrEqual: | |
87 { | |
88 std::string op; | |
89 switch (constraint.GetConstraintType()) | |
90 { | |
91 case ConstraintType_Equal: | |
92 op = "="; | |
93 break; | |
94 | |
95 case ConstraintType_SmallerOrEqual: | |
96 op = "<="; | |
97 break; | |
98 | |
99 case ConstraintType_GreaterOrEqual: | |
100 op = ">="; | |
101 break; | |
102 | |
103 default: | |
104 throw OrthancException(ErrorCode_InternalError); | |
105 } | |
106 | |
107 std::string parameter = formatter.GenerateParameter(constraint.GetSingleValue()); | |
108 | |
109 if (constraint.IsCaseSensitive()) | |
110 { | |
111 comparison = tag + ".value " + op + " " + parameter; | |
112 } | |
113 else | |
114 { | |
115 comparison = "lower(" + tag + ".value) " + op + " lower(" + parameter + ")"; | |
116 } | |
117 | |
118 break; | |
119 } | |
120 | |
121 case ConstraintType_List: | |
122 { | |
123 for (size_t i = 0; i < constraint.GetValuesCount(); i++) | |
124 { | |
125 if (!comparison.empty()) | |
126 { | |
127 comparison += ", "; | |
128 } | |
129 | |
130 std::string parameter = formatter.GenerateParameter(constraint.GetValue(i)); | |
131 | |
132 if (constraint.IsCaseSensitive()) | |
133 { | |
134 comparison += parameter; | |
135 } | |
136 else | |
137 { | |
138 comparison += "lower(" + parameter + ")"; | |
139 } | |
140 } | |
141 | |
142 if (constraint.IsCaseSensitive()) | |
143 { | |
144 comparison = tag + ".value IN (" + comparison + ")"; | |
145 } | |
146 else | |
147 { | |
148 comparison = "lower(" + tag + ".value) IN (" + comparison + ")"; | |
149 } | |
150 | |
151 break; | |
152 } | |
153 | |
154 case ConstraintType_Wildcard: | |
155 { | |
156 const std::string value = constraint.GetSingleValue(); | |
157 | |
158 if (value == "*") | |
159 { | |
160 if (!constraint.IsMandatory()) | |
161 { | |
162 // Universal constraint on an optional tag, ignore it | |
163 return false; | |
164 } | |
165 } | |
166 else | |
167 { | |
168 std::string escaped; | |
169 escaped.reserve(value.size()); | |
170 | |
171 for (size_t i = 0; i < value.size(); i++) | |
172 { | |
173 if (value[i] == '*') | |
174 { | |
175 escaped += "%"; | |
176 } | |
177 else if (value[i] == '?') | |
178 { | |
179 escaped += "_"; | |
180 } | |
181 else if (value[i] == '%') | |
182 { | |
183 escaped += "\\%"; | |
184 } | |
185 else if (value[i] == '_') | |
186 { | |
187 escaped += "\\_"; | |
188 } | |
189 else if (value[i] == '\\') | |
190 { | |
191 escaped += "\\\\"; | |
192 } | |
354
2a3bbb4104fa
fix changeset 389c037387ea
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
353
diff
changeset
|
193 else if (escapeBrackets && value[i] == '[') |
2a3bbb4104fa
fix changeset 389c037387ea
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
353
diff
changeset
|
194 { |
2a3bbb4104fa
fix changeset 389c037387ea
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
353
diff
changeset
|
195 escaped += "\\["; |
2a3bbb4104fa
fix changeset 389c037387ea
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
353
diff
changeset
|
196 } |
2a3bbb4104fa
fix changeset 389c037387ea
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
353
diff
changeset
|
197 else if (escapeBrackets && value[i] == ']') |
2a3bbb4104fa
fix changeset 389c037387ea
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
353
diff
changeset
|
198 { |
2a3bbb4104fa
fix changeset 389c037387ea
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
353
diff
changeset
|
199 escaped += "\\]"; |
2a3bbb4104fa
fix changeset 389c037387ea
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
353
diff
changeset
|
200 } |
152 | 201 else |
202 { | |
203 escaped += value[i]; | |
204 } | |
205 } | |
206 | |
207 std::string parameter = formatter.GenerateParameter(escaped); | |
208 | |
209 if (constraint.IsCaseSensitive()) | |
210 { | |
211 comparison = (tag + ".value LIKE " + parameter + " " + | |
212 formatter.FormatWildcardEscape()); | |
213 } | |
214 else | |
215 { | |
216 comparison = ("lower(" + tag + ".value) LIKE lower(" + | |
217 parameter + ") " + formatter.FormatWildcardEscape()); | |
218 } | |
219 } | |
220 | |
221 break; | |
222 } | |
223 | |
224 default: | |
225 return false; | |
226 } | |
227 | |
228 if (constraint.IsMandatory()) | |
229 { | |
230 target = comparison; | |
231 } | |
232 else if (comparison.empty()) | |
233 { | |
234 target = tag + ".value IS NULL"; | |
235 } | |
236 else | |
237 { | |
238 target = tag + ".value IS NULL OR " + comparison; | |
239 } | |
240 | |
241 return true; | |
242 } | |
243 | |
244 | |
245 static void FormatJoin(std::string& target, | |
246 const DatabaseConstraint& constraint, | |
247 size_t index) | |
248 { | |
249 std::string tag = "t" + boost::lexical_cast<std::string>(index); | |
250 | |
251 if (constraint.IsMandatory()) | |
252 { | |
253 target = " INNER JOIN "; | |
254 } | |
255 else | |
256 { | |
257 target = " LEFT JOIN "; | |
258 } | |
259 | |
260 if (constraint.IsIdentifier()) | |
261 { | |
262 target += "DicomIdentifiers "; | |
263 } | |
264 else | |
265 { | |
266 target += "MainDicomTags "; | |
267 } | |
268 | |
269 target += (tag + " ON " + tag + ".id = " + FormatLevel(constraint.GetLevel()) + | |
270 ".internalId AND " + tag + ".tagGroup = " + | |
271 boost::lexical_cast<std::string>(constraint.GetTag().GetGroup()) + | |
272 " AND " + tag + ".tagElement = " + | |
273 boost::lexical_cast<std::string>(constraint.GetTag().GetElement())); | |
274 } | |
405 | 275 |
276 | |
277 static std::string Join(const std::list<std::string>& values, | |
278 const std::string& prefix, | |
279 const std::string& separator) | |
280 { | |
281 if (values.empty()) | |
282 { | |
283 return ""; | |
284 } | |
285 else | |
286 { | |
287 std::string s = prefix; | |
288 | |
289 bool first = true; | |
290 for (std::list<std::string>::const_iterator it = values.begin(); it != values.end(); ++it) | |
291 { | |
292 if (first) | |
293 { | |
294 first = false; | |
295 } | |
296 else | |
297 { | |
298 s += separator; | |
299 } | |
300 | |
301 s += *it; | |
302 } | |
303 | |
304 return s; | |
305 } | |
306 } | |
414
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
307 |
425 | 308 static bool FormatComparison2(std::string& target, |
309 ISqlLookupFormatter& formatter, | |
310 const DatabaseConstraint& constraint, | |
311 bool escapeBrackets) | |
414
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
312 { |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
313 std::string comparison; |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
314 std::string tagFilter = ("tagGroup = " + boost::lexical_cast<std::string>(constraint.GetTag().GetGroup()) |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
315 + " AND tagElement = " + boost::lexical_cast<std::string>(constraint.GetTag().GetElement())); |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
316 |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
317 switch (constraint.GetConstraintType()) |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
318 { |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
319 case ConstraintType_Equal: |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
320 case ConstraintType_SmallerOrEqual: |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
321 case ConstraintType_GreaterOrEqual: |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
322 { |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
323 std::string op; |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
324 switch (constraint.GetConstraintType()) |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
325 { |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
326 case ConstraintType_Equal: |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
327 op = "="; |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
328 break; |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
329 |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
330 case ConstraintType_SmallerOrEqual: |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
331 op = "<="; |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
332 break; |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
333 |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
334 case ConstraintType_GreaterOrEqual: |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
335 op = ">="; |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
336 break; |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
337 |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
338 default: |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
339 throw OrthancException(ErrorCode_InternalError); |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
340 } |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
341 |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
342 std::string parameter = formatter.GenerateParameter(constraint.GetSingleValue()); |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
343 |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
344 if (constraint.IsCaseSensitive()) |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
345 { |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
346 comparison = " AND value " + op + " " + parameter; |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
347 } |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
348 else |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
349 { |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
350 comparison = " AND lower(value) " + op + " lower(" + parameter + ")"; |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
351 } |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
352 |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
353 break; |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
354 } |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
355 |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
356 case ConstraintType_List: |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
357 { |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
358 std::vector<std::string> comparisonValues; |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
359 for (size_t i = 0; i < constraint.GetValuesCount(); i++) |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
360 { |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
361 std::string parameter = formatter.GenerateParameter(constraint.GetValue(i)); |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
362 |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
363 if (constraint.IsCaseSensitive()) |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
364 { |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
365 comparisonValues.push_back(parameter); |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
366 } |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
367 else |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
368 { |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
369 comparisonValues.push_back("lower(" + parameter + ")"); |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
370 } |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
371 } |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
372 |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
373 std::string values; |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
374 Toolbox::JoinStrings(values, comparisonValues, ", "); |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
375 |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
376 if (constraint.IsCaseSensitive()) |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
377 { |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
378 comparison = " AND value IN (" + values + ")"; |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
379 } |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
380 else |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
381 { |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
382 comparison = " AND lower(value) IN (" + values + ")"; |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
383 } |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
384 |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
385 break; |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
386 } |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
387 |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
388 case ConstraintType_Wildcard: |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
389 { |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
390 const std::string value = constraint.GetSingleValue(); |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
391 |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
392 if (value == "*") |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
393 { |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
394 if (!constraint.IsMandatory()) |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
395 { |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
396 // Universal constraint on an optional tag, ignore it |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
397 return false; |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
398 } |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
399 } |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
400 else |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
401 { |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
402 std::string escaped; |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
403 escaped.reserve(value.size()); |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
404 |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
405 for (size_t i = 0; i < value.size(); i++) |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
406 { |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
407 if (value[i] == '*') |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
408 { |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
409 escaped += "%"; |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
410 } |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
411 else if (value[i] == '?') |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
412 { |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
413 escaped += "_"; |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
414 } |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
415 else if (value[i] == '%') |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
416 { |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
417 escaped += "\\%"; |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
418 } |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
419 else if (value[i] == '_') |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
420 { |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
421 escaped += "\\_"; |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
422 } |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
423 else if (value[i] == '\\') |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
424 { |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
425 escaped += "\\\\"; |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
426 } |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
427 else if (escapeBrackets && value[i] == '[') |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
428 { |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
429 escaped += "\\["; |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
430 } |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
431 else if (escapeBrackets && value[i] == ']') |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
432 { |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
433 escaped += "\\]"; |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
434 } |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
435 else |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
436 { |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
437 escaped += value[i]; |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
438 } |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
439 } |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
440 |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
441 std::string parameter = formatter.GenerateParameter(escaped); |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
442 |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
443 if (constraint.IsCaseSensitive()) |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
444 { |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
445 comparison = " AND value LIKE " + parameter + " " + formatter.FormatWildcardEscape(); |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
446 } |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
447 else |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
448 { |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
449 comparison = " AND lower(value) LIKE lower(" + parameter + ") " + formatter.FormatWildcardEscape(); |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
450 } |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
451 } |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
452 |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
453 break; |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
454 } |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
455 |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
456 default: |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
457 return false; |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
458 } |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
459 |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
460 if (constraint.IsMandatory()) |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
461 { |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
462 target = tagFilter + comparison; |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
463 } |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
464 else if (comparison.empty()) |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
465 { |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
466 target = tagFilter + " AND value IS NULL"; |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
467 } |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
468 else |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
469 { |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
470 target = tagFilter + " AND value IS NULL OR " + comparison; |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
471 } |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
472 |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
473 return true; |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
474 } |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
475 |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
476 |
415
7e123f047771
LookupResources optimization continued
Alain Mazy <am@osimis.io>
parents:
414
diff
changeset
|
477 void ISqlLookupFormatter::GetLookupLevels(ResourceType& lowerLevel, ResourceType& upperLevel, const ResourceType& queryLevel, const std::vector<DatabaseConstraint>& lookup) |
152 | 478 { |
479 assert(ResourceType_Patient < ResourceType_Study && | |
480 ResourceType_Study < ResourceType_Series && | |
481 ResourceType_Series < ResourceType_Instance); | |
482 | |
415
7e123f047771
LookupResources optimization continued
Alain Mazy <am@osimis.io>
parents:
414
diff
changeset
|
483 lowerLevel = queryLevel; |
7e123f047771
LookupResources optimization continued
Alain Mazy <am@osimis.io>
parents:
414
diff
changeset
|
484 upperLevel = queryLevel; |
152 | 485 |
486 for (size_t i = 0; i < lookup.size(); i++) | |
487 { | |
488 ResourceType level = lookup[i].GetLevel(); | |
489 | |
490 if (level < upperLevel) | |
491 { | |
492 upperLevel = level; | |
493 } | |
494 | |
495 if (level > lowerLevel) | |
496 { | |
497 lowerLevel = level; | |
498 } | |
499 } | |
415
7e123f047771
LookupResources optimization continued
Alain Mazy <am@osimis.io>
parents:
414
diff
changeset
|
500 } |
7e123f047771
LookupResources optimization continued
Alain Mazy <am@osimis.io>
parents:
414
diff
changeset
|
501 |
7e123f047771
LookupResources optimization continued
Alain Mazy <am@osimis.io>
parents:
414
diff
changeset
|
502 |
7e123f047771
LookupResources optimization continued
Alain Mazy <am@osimis.io>
parents:
414
diff
changeset
|
503 void ISqlLookupFormatter::Apply(std::string& sql, |
7e123f047771
LookupResources optimization continued
Alain Mazy <am@osimis.io>
parents:
414
diff
changeset
|
504 ISqlLookupFormatter& formatter, |
7e123f047771
LookupResources optimization continued
Alain Mazy <am@osimis.io>
parents:
414
diff
changeset
|
505 const std::vector<DatabaseConstraint>& lookup, |
7e123f047771
LookupResources optimization continued
Alain Mazy <am@osimis.io>
parents:
414
diff
changeset
|
506 ResourceType queryLevel, |
7e123f047771
LookupResources optimization continued
Alain Mazy <am@osimis.io>
parents:
414
diff
changeset
|
507 const std::set<std::string>& labels, |
7e123f047771
LookupResources optimization continued
Alain Mazy <am@osimis.io>
parents:
414
diff
changeset
|
508 LabelsConstraint labelsConstraint, |
7e123f047771
LookupResources optimization continued
Alain Mazy <am@osimis.io>
parents:
414
diff
changeset
|
509 size_t limit) |
7e123f047771
LookupResources optimization continued
Alain Mazy <am@osimis.io>
parents:
414
diff
changeset
|
510 { |
7e123f047771
LookupResources optimization continued
Alain Mazy <am@osimis.io>
parents:
414
diff
changeset
|
511 ResourceType lowerLevel, upperLevel; |
7e123f047771
LookupResources optimization continued
Alain Mazy <am@osimis.io>
parents:
414
diff
changeset
|
512 GetLookupLevels(lowerLevel, upperLevel, queryLevel, lookup); |
7e123f047771
LookupResources optimization continued
Alain Mazy <am@osimis.io>
parents:
414
diff
changeset
|
513 |
152 | 514 assert(upperLevel <= queryLevel && |
515 queryLevel <= lowerLevel); | |
516 | |
354
2a3bbb4104fa
fix changeset 389c037387ea
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
353
diff
changeset
|
517 const bool escapeBrackets = formatter.IsEscapeBrackets(); |
2a3bbb4104fa
fix changeset 389c037387ea
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
353
diff
changeset
|
518 |
152 | 519 std::string joins, comparisons; |
520 | |
521 size_t count = 0; | |
522 | |
523 for (size_t i = 0; i < lookup.size(); i++) | |
524 { | |
525 std::string comparison; | |
526 | |
354
2a3bbb4104fa
fix changeset 389c037387ea
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
353
diff
changeset
|
527 if (FormatComparison(comparison, formatter, lookup[i], count, escapeBrackets)) |
152 | 528 { |
529 std::string join; | |
530 FormatJoin(join, lookup[i], count); | |
531 joins += join; | |
532 | |
533 if (!comparison.empty()) | |
534 { | |
535 comparisons += " AND " + comparison; | |
536 } | |
537 | |
538 count ++; | |
539 } | |
540 } | |
541 | |
542 sql = ("SELECT " + | |
543 FormatLevel(queryLevel) + ".publicId, " + | |
544 FormatLevel(queryLevel) + ".internalId" + | |
545 " FROM Resources AS " + FormatLevel(queryLevel)); | |
546 | |
547 for (int level = queryLevel - 1; level >= upperLevel; level--) | |
548 { | |
549 sql += (" INNER JOIN Resources " + | |
550 FormatLevel(static_cast<ResourceType>(level)) + " ON " + | |
551 FormatLevel(static_cast<ResourceType>(level)) + ".internalId=" + | |
552 FormatLevel(static_cast<ResourceType>(level + 1)) + ".parentId"); | |
553 } | |
554 | |
555 for (int level = queryLevel + 1; level <= lowerLevel; level++) | |
556 { | |
557 sql += (" INNER JOIN Resources " + | |
558 FormatLevel(static_cast<ResourceType>(level)) + " ON " + | |
559 FormatLevel(static_cast<ResourceType>(level - 1)) + ".internalId=" + | |
560 FormatLevel(static_cast<ResourceType>(level)) + ".parentId"); | |
561 } | |
405 | 562 |
563 std::list<std::string> where; | |
564 where.push_back(FormatLevel(queryLevel) + ".resourceType = " + | |
565 formatter.FormatResourceType(queryLevel) + comparisons); | |
566 | |
567 if (!labels.empty()) | |
568 { | |
569 /** | |
570 * "In SQL Server, NOT EXISTS and NOT IN predicates are the best | |
571 * way to search for missing values, as long as both columns in | |
572 * question are NOT NULL." | |
573 * https://explainextended.com/2009/09/15/not-in-vs-not-exists-vs-left-join-is-null-sql-server/ | |
574 **/ | |
575 | |
576 std::list<std::string> formattedLabels; | |
577 for (std::set<std::string>::const_iterator it = labels.begin(); it != labels.end(); ++it) | |
578 { | |
579 formattedLabels.push_back(formatter.GenerateParameter(*it)); | |
580 } | |
581 | |
582 std::string condition; | |
583 switch (labelsConstraint) | |
584 { | |
585 case LabelsConstraint_Any: | |
586 condition = "> 0"; | |
587 break; | |
588 | |
589 case LabelsConstraint_All: | |
590 condition = "= " + boost::lexical_cast<std::string>(labels.size()); | |
591 break; | |
592 | |
593 case LabelsConstraint_None: | |
594 condition = "= 0"; | |
595 break; | |
596 | |
597 default: | |
598 throw OrthancException(ErrorCode_ParameterOutOfRange); | |
599 } | |
152 | 600 |
405 | 601 where.push_back("(SELECT COUNT(1) FROM Labels AS selectedLabels WHERE selectedLabels.id = " + FormatLevel(queryLevel) + |
602 ".internalId AND selectedLabels.label IN (" + Join(formattedLabels, "", ", ") + ")) " + condition); | |
603 } | |
604 | |
605 sql += joins + Join(where, " WHERE ", " AND "); | |
152 | 606 |
607 if (limit != 0) | |
608 { | |
609 sql += " LIMIT " + boost::lexical_cast<std::string>(limit); | |
610 } | |
611 } | |
414
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
612 |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
613 |
415
7e123f047771
LookupResources optimization continued
Alain Mazy <am@osimis.io>
parents:
414
diff
changeset
|
614 void ISqlLookupFormatter::ApplySingleLevel(std::string& sql, |
7e123f047771
LookupResources optimization continued
Alain Mazy <am@osimis.io>
parents:
414
diff
changeset
|
615 ISqlLookupFormatter& formatter, |
7e123f047771
LookupResources optimization continued
Alain Mazy <am@osimis.io>
parents:
414
diff
changeset
|
616 const std::vector<DatabaseConstraint>& lookup, |
7e123f047771
LookupResources optimization continued
Alain Mazy <am@osimis.io>
parents:
414
diff
changeset
|
617 ResourceType queryLevel, |
7e123f047771
LookupResources optimization continued
Alain Mazy <am@osimis.io>
parents:
414
diff
changeset
|
618 const std::set<std::string>& labels, |
7e123f047771
LookupResources optimization continued
Alain Mazy <am@osimis.io>
parents:
414
diff
changeset
|
619 LabelsConstraint labelsConstraint, |
7e123f047771
LookupResources optimization continued
Alain Mazy <am@osimis.io>
parents:
414
diff
changeset
|
620 size_t limit |
7e123f047771
LookupResources optimization continued
Alain Mazy <am@osimis.io>
parents:
414
diff
changeset
|
621 ) |
414
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
622 { |
415
7e123f047771
LookupResources optimization continued
Alain Mazy <am@osimis.io>
parents:
414
diff
changeset
|
623 ResourceType lowerLevel, upperLevel; |
7e123f047771
LookupResources optimization continued
Alain Mazy <am@osimis.io>
parents:
414
diff
changeset
|
624 GetLookupLevels(lowerLevel, upperLevel, queryLevel, lookup); |
414
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
625 |
415
7e123f047771
LookupResources optimization continued
Alain Mazy <am@osimis.io>
parents:
414
diff
changeset
|
626 assert(upperLevel == queryLevel && |
7e123f047771
LookupResources optimization continued
Alain Mazy <am@osimis.io>
parents:
414
diff
changeset
|
627 queryLevel == lowerLevel); |
414
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
628 |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
629 const bool escapeBrackets = formatter.IsEscapeBrackets(); |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
630 |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
631 std::vector<std::string> mainDicomTagsComparisons, dicomIdentifiersComparisons; |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
632 |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
633 for (size_t i = 0; i < lookup.size(); i++) |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
634 { |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
635 std::string comparison; |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
636 |
425 | 637 if (FormatComparison2(comparison, formatter, lookup[i], escapeBrackets)) |
414
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
638 { |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
639 if (!comparison.empty()) |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
640 { |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
641 if (lookup[i].IsIdentifier()) |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
642 { |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
643 dicomIdentifiersComparisons.push_back(comparison); |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
644 } |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
645 else |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
646 { |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
647 mainDicomTagsComparisons.push_back(comparison); |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
648 } |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
649 } |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
650 } |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
651 } |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
652 |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
653 sql = ("SELECT publicId, internalId " |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
654 "FROM Resources " |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
655 "WHERE resourceType = " + formatter.FormatResourceType(queryLevel) |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
656 + " "); |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
657 |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
658 if (dicomIdentifiersComparisons.size() > 0) |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
659 { |
416 | 660 for (std::vector<std::string>::const_iterator it = dicomIdentifiersComparisons.begin(); it < dicomIdentifiersComparisons.end(); ++it) |
661 { | |
662 sql += (" AND internalId IN (SELECT id FROM DicomIdentifiers WHERE " + *it + ") "); | |
663 } | |
414
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
664 } |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
665 |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
666 if (mainDicomTagsComparisons.size() > 0) |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
667 { |
416 | 668 for (std::vector<std::string>::const_iterator it = mainDicomTagsComparisons.begin(); it < mainDicomTagsComparisons.end(); ++it) |
669 { | |
670 sql += (" AND internalId IN (SELECT id FROM MainDicomTags WHERE " + *it + ") "); | |
671 } | |
414
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
672 } |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
673 |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
674 if (!labels.empty()) |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
675 { |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
676 /** |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
677 * "In SQL Server, NOT EXISTS and NOT IN predicates are the best |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
678 * way to search for missing values, as long as both columns in |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
679 * question are NOT NULL." |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
680 * https://explainextended.com/2009/09/15/not-in-vs-not-exists-vs-left-join-is-null-sql-server/ |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
681 **/ |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
682 |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
683 std::list<std::string> formattedLabels; |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
684 for (std::set<std::string>::const_iterator it = labels.begin(); it != labels.end(); ++it) |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
685 { |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
686 formattedLabels.push_back(formatter.GenerateParameter(*it)); |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
687 } |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
688 |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
689 std::string condition; |
415
7e123f047771
LookupResources optimization continued
Alain Mazy <am@osimis.io>
parents:
414
diff
changeset
|
690 std::string inOrNotIn; |
414
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
691 switch (labelsConstraint) |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
692 { |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
693 case LabelsConstraint_Any: |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
694 condition = "> 0"; |
415
7e123f047771
LookupResources optimization continued
Alain Mazy <am@osimis.io>
parents:
414
diff
changeset
|
695 inOrNotIn = "IN"; |
414
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
696 break; |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
697 |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
698 case LabelsConstraint_All: |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
699 condition = "= " + boost::lexical_cast<std::string>(labels.size()); |
415
7e123f047771
LookupResources optimization continued
Alain Mazy <am@osimis.io>
parents:
414
diff
changeset
|
700 inOrNotIn = "IN"; |
414
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
701 break; |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
702 |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
703 case LabelsConstraint_None: |
415
7e123f047771
LookupResources optimization continued
Alain Mazy <am@osimis.io>
parents:
414
diff
changeset
|
704 condition = "> 0"; |
7e123f047771
LookupResources optimization continued
Alain Mazy <am@osimis.io>
parents:
414
diff
changeset
|
705 inOrNotIn = "NOT IN"; |
414
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
706 break; |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
707 |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
708 default: |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
709 throw OrthancException(ErrorCode_ParameterOutOfRange); |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
710 } |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
711 |
415
7e123f047771
LookupResources optimization continued
Alain Mazy <am@osimis.io>
parents:
414
diff
changeset
|
712 sql += (" AND internalId " + inOrNotIn + " (SELECT id" |
414
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
713 " FROM (SELECT id, COUNT(1) AS labelsCount " |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
714 "FROM Labels " |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
715 "WHERE label IN (" + Join(formattedLabels, "", ", ") + ") GROUP BY id" |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
716 ") AS temp " |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
717 " WHERE labelsCount " + condition + ")"); |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
718 } |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
719 |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
720 if (limit != 0) |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
721 { |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
722 sql += " LIMIT " + boost::lexical_cast<std::string>(limit); |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
723 } |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
724 } |
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
725 |
152 | 726 } |