Mercurial > hg > orthanc-databases
annotate Resources/Orthanc/Databases/ISqlLookupFormatter.h @ 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:
426
diff
changeset
|
5 * Copyright (C) 2017-2024 Osimis S.A., Belgium |
ecd0b719cff5
update year to 2024
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
426
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 #pragma once | |
24 | |
25 #if ORTHANC_BUILDING_SERVER_LIBRARY == 1 | |
26 # include "../../../OrthancFramework/Sources/Enumerations.h" | |
27 #else | |
28 # include <Enumerations.h> | |
29 #endif | |
30 | |
31 #include <boost/noncopyable.hpp> | |
32 #include <vector> | |
33 | |
34 namespace Orthanc | |
35 { | |
36 class DatabaseConstraint; | |
37 | |
405 | 38 enum LabelsConstraint |
39 { | |
40 LabelsConstraint_All, | |
41 LabelsConstraint_Any, | |
42 LabelsConstraint_None | |
43 }; | |
44 | |
152 | 45 // This class is also used by the "orthanc-databases" project |
46 class ISqlLookupFormatter : public boost::noncopyable | |
47 { | |
48 public: | |
49 virtual ~ISqlLookupFormatter() | |
50 { | |
51 } | |
52 | |
53 virtual std::string GenerateParameter(const std::string& value) = 0; | |
54 | |
55 virtual std::string FormatResourceType(ResourceType level) = 0; | |
56 | |
57 virtual std::string FormatWildcardEscape() = 0; | |
58 | |
354
2a3bbb4104fa
fix changeset 389c037387ea
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
285
diff
changeset
|
59 /** |
2a3bbb4104fa
fix changeset 389c037387ea
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
285
diff
changeset
|
60 * Whether to escape '[' and ']', which is only needed for |
405 | 61 * MSSQL. New in Orthanc 1.10.0, from the following changeset: |
426
d700c8f9fc24
migration to UCLouvain servers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
415
diff
changeset
|
62 * https://orthanc.uclouvain.be/hg/orthanc-databases/rev/389c037387ea |
354
2a3bbb4104fa
fix changeset 389c037387ea
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
285
diff
changeset
|
63 **/ |
2a3bbb4104fa
fix changeset 389c037387ea
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
285
diff
changeset
|
64 virtual bool IsEscapeBrackets() const = 0; |
2a3bbb4104fa
fix changeset 389c037387ea
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
285
diff
changeset
|
65 |
415
7e123f047771
LookupResources optimization continued
Alain Mazy <am@osimis.io>
parents:
414
diff
changeset
|
66 static void GetLookupLevels(ResourceType& lowerLevel, ResourceType& upperLevel, const ResourceType& queryLevel, const std::vector<DatabaseConstraint>& lookup); |
7e123f047771
LookupResources optimization continued
Alain Mazy <am@osimis.io>
parents:
414
diff
changeset
|
67 |
152 | 68 static void Apply(std::string& sql, |
69 ISqlLookupFormatter& formatter, | |
70 const std::vector<DatabaseConstraint>& lookup, | |
71 ResourceType queryLevel, | |
405 | 72 const std::set<std::string>& labels, // New in Orthanc 1.12.0 |
73 LabelsConstraint labelsConstraint, // New in Orthanc 1.12.0 | |
152 | 74 size_t limit); |
414
f2d3b5c5a68d
Optimizing tools/find at studies level only. Integ Tests are ok with PG
Alain Mazy <am@osimis.io>
parents:
406
diff
changeset
|
75 |
415
7e123f047771
LookupResources optimization continued
Alain Mazy <am@osimis.io>
parents:
414
diff
changeset
|
76 static void ApplySingleLevel(std::string& sql, |
7e123f047771
LookupResources optimization continued
Alain Mazy <am@osimis.io>
parents:
414
diff
changeset
|
77 ISqlLookupFormatter& formatter, |
7e123f047771
LookupResources optimization continued
Alain Mazy <am@osimis.io>
parents:
414
diff
changeset
|
78 const std::vector<DatabaseConstraint>& lookup, |
7e123f047771
LookupResources optimization continued
Alain Mazy <am@osimis.io>
parents:
414
diff
changeset
|
79 ResourceType queryLevel, |
7e123f047771
LookupResources optimization continued
Alain Mazy <am@osimis.io>
parents:
414
diff
changeset
|
80 const std::set<std::string>& labels, // New in Orthanc 1.12.0 |
7e123f047771
LookupResources optimization continued
Alain Mazy <am@osimis.io>
parents:
414
diff
changeset
|
81 LabelsConstraint labelsConstraint, // New in Orthanc 1.12.0 |
7e123f047771
LookupResources optimization continued
Alain Mazy <am@osimis.io>
parents:
414
diff
changeset
|
82 size_t limit); |
152 | 83 }; |
84 } |