Mercurial > hg > orthanc-databases
comparison Framework/Plugins/ISqlLookupFormatter.h @ 569:f18e46d7dbf8 attach-custom-data
merged find-refactoring -> attach-custom-data
author | Alain Mazy <am@orthanc.team> |
---|---|
date | Tue, 24 Sep 2024 15:04:21 +0200 |
parents | 7f45f23b10d0 |
children |
comparison
equal
deleted
inserted
replaced
368:82f73188b58d | 569:f18e46d7dbf8 |
---|---|
1 /** | |
2 * Orthanc - A Lightweight, RESTful DICOM Store | |
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics | |
4 * Department, University Hospital of Liege, Belgium | |
5 * Copyright (C) 2017-2023 Osimis S.A., Belgium | |
6 * Copyright (C) 2024-2024 Orthanc Team SRL, Belgium | |
7 * Copyright (C) 2021-2024 Sebastien Jodogne, ICTEAM UCLouvain, Belgium | |
8 * | |
9 * This program is free software: you can redistribute it and/or | |
10 * modify it under the terms of the GNU Affero General Public License | |
11 * as published by the Free Software Foundation, either version 3 of | |
12 * the License, or (at your option) any later version. | |
13 * | |
14 * This program is distributed in the hope that it will be useful, but | |
15 * WITHOUT ANY WARRANTY; without even the implied warranty of | |
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
17 * Affero General Public License for more details. | |
18 * | |
19 * You should have received a copy of the GNU Affero General Public License | |
20 * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
21 **/ | |
22 | |
23 | |
24 /** | |
25 * NB: Until 2024-09-09, this file was synchronized with the following | |
26 * folder from the Orthanc main project: | |
27 * https://orthanc.uclouvain.be/hg/orthanc/file/default/OrthancServer/Sources/Search/ | |
28 **/ | |
29 | |
30 | |
31 #pragma once | |
32 | |
33 #include "MessagesToolbox.h" | |
34 | |
35 #include <boost/noncopyable.hpp> | |
36 #include <vector> | |
37 | |
38 namespace OrthancDatabases | |
39 { | |
40 class DatabaseConstraints; | |
41 class FindRequest; | |
42 | |
43 enum LabelsConstraint | |
44 { | |
45 LabelsConstraint_All, | |
46 LabelsConstraint_Any, | |
47 LabelsConstraint_None | |
48 }; | |
49 | |
50 class ISqlLookupFormatter : public boost::noncopyable | |
51 { | |
52 public: | |
53 virtual ~ISqlLookupFormatter() | |
54 { | |
55 } | |
56 | |
57 virtual std::string GenerateParameter(const std::string& value) = 0; | |
58 | |
59 virtual std::string FormatResourceType(Orthanc::ResourceType level) = 0; | |
60 | |
61 virtual std::string FormatWildcardEscape() = 0; | |
62 | |
63 virtual std::string FormatLimits(uint64_t since, uint64_t count) = 0; | |
64 | |
65 /** | |
66 * Whether to escape '[' and ']', which is only needed for | |
67 * MSSQL. New in Orthanc 1.10.0, from the following changeset: | |
68 * https://orthanc.uclouvain.be/hg/orthanc-databases/rev/389c037387ea | |
69 **/ | |
70 virtual bool IsEscapeBrackets() const = 0; | |
71 | |
72 static void GetLookupLevels(Orthanc::ResourceType& lowerLevel, | |
73 Orthanc::ResourceType& upperLevel, | |
74 const Orthanc::ResourceType& queryLevel, | |
75 const DatabaseConstraints& lookup); | |
76 | |
77 static void Apply(std::string& sql, | |
78 ISqlLookupFormatter& formatter, | |
79 const DatabaseConstraints& lookup, | |
80 Orthanc::ResourceType queryLevel, | |
81 const std::set<std::string>& labels, // New in Orthanc 1.12.0 | |
82 LabelsConstraint labelsConstraint, // New in Orthanc 1.12.0 | |
83 size_t limit); | |
84 | |
85 static void ApplySingleLevel(std::string& sql, | |
86 ISqlLookupFormatter& formatter, | |
87 const DatabaseConstraints& lookup, | |
88 Orthanc::ResourceType queryLevel, | |
89 const std::set<std::string>& labels, // New in Orthanc 1.12.0 | |
90 LabelsConstraint labelsConstraint, // New in Orthanc 1.12.0 | |
91 size_t limit); | |
92 | |
93 #if ORTHANC_PLUGINS_HAS_INTEGRATED_FIND == 1 | |
94 static void Apply(std::string& sql, | |
95 ISqlLookupFormatter& formatter, | |
96 const Orthanc::DatabasePluginMessages::Find_Request& request); | |
97 #endif | |
98 }; | |
99 } |