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