Mercurial > hg > orthanc-databases
annotate Framework/PostgreSQL/PostgreSQLStatement.h @ 583:ae7375d38607 find-refactoring tip
MySQL: fix ordering
author | Alain Mazy <am@orthanc.team> |
---|---|
date | Mon, 21 Oct 2024 18:19:51 +0200 |
parents | 54d518dcd74a |
children |
rev | line source |
---|---|
0 | 1 /** |
2 * Orthanc - A Lightweight, RESTful DICOM Store | |
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics | |
4 * Department, University Hospital of Liege, Belgium | |
507
54d518dcd74a
updated copyright, as Orthanc Team now replaces Osimis
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
459
diff
changeset
|
5 * Copyright (C) 2017-2023 Osimis S.A., Belgium |
54d518dcd74a
updated copyright, as Orthanc Team now replaces Osimis
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
459
diff
changeset
|
6 * Copyright (C) 2024-2024 Orthanc Team SRL, Belgium |
459
ecd0b719cff5
update year to 2024
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
389
diff
changeset
|
7 * Copyright (C) 2021-2024 Sebastien Jodogne, ICTEAM UCLouvain, Belgium |
0 | 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 #pragma once | |
25 | |
26 #if ORTHANC_ENABLE_POSTGRESQL != 1 | |
27 # error PostgreSQL support must be enabled to use this file | |
28 #endif | |
29 | |
30 #include "../Common/IPrecompiledStatement.h" | |
31 #include "../Common/Query.h" | |
32 #include "../Common/GenericFormatter.h" | |
33 | |
34 #include "PostgreSQLDatabase.h" | |
35 #include "PostgreSQLLargeObject.h" | |
36 #include "PostgreSQLTransaction.h" | |
37 | |
38 #include <vector> | |
39 #include <memory> | |
40 #include <boost/shared_ptr.hpp> | |
41 | |
42 namespace OrthancDatabases | |
43 { | |
44 class PostgreSQLStatement : public IPrecompiledStatement | |
45 { | |
46 private: | |
47 class ResultWrapper; | |
48 class Inputs; | |
49 friend class PostgreSQLResult; | |
50 | |
51 PostgreSQLDatabase& database_; | |
52 std::string id_; | |
53 std::string sql_; | |
54 std::vector<unsigned int /*Oid*/> oids_; | |
55 std::vector<int> binary_; | |
56 boost::shared_ptr<Inputs> inputs_; | |
57 GenericFormatter formatter_; | |
58 | |
59 void Prepare(); | |
60 | |
61 void Unprepare(); | |
62 | |
63 void DeclareInputInternal(unsigned int param, | |
64 unsigned int /*Oid*/ type); | |
65 | |
66 void* /* PGresult* */ Execute(); | |
67 | |
68 public: | |
69 PostgreSQLStatement(PostgreSQLDatabase& database, | |
214
ab96698c73a3
removed useless information about read-only in ITransaction and IPrecompiledStatement
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
193
diff
changeset
|
70 const std::string& sql); |
0 | 71 |
72 PostgreSQLStatement(PostgreSQLDatabase& database, | |
73 const Query& query); | |
74 | |
46
6a574d810b98
Compatibility with MySQL 8.0
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
23
diff
changeset
|
75 ~PostgreSQLStatement(); |
0 | 76 |
77 void DeclareInputInteger(unsigned int param); | |
78 | |
79 void DeclareInputInteger64(unsigned int param); | |
80 | |
81 void DeclareInputString(unsigned int param); | |
82 | |
83 void DeclareInputBinary(unsigned int param); | |
84 | |
85 void DeclareInputLargeObject(unsigned int param); | |
86 | |
87 void Run(); | |
88 | |
89 void BindNull(unsigned int param); | |
90 | |
91 void BindInteger(unsigned int param, int value); | |
92 | |
93 void BindInteger64(unsigned int param, int64_t value); | |
94 | |
95 void BindString(unsigned int param, const std::string& value); | |
96 | |
97 void BindLargeObject(unsigned int param, const PostgreSQLLargeObject& value); | |
98 | |
99 PostgreSQLDatabase& GetDatabase() const | |
100 { | |
101 return database_; | |
102 } | |
103 | |
23
b2ff1cd2907a
handling of implicit transactions in DatabaseManager
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
0
diff
changeset
|
104 IResult* Execute(ITransaction& transaction, |
0 | 105 const Dictionary& parameters); |
106 | |
23
b2ff1cd2907a
handling of implicit transactions in DatabaseManager
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
0
diff
changeset
|
107 void ExecuteWithoutResult(ITransaction& transaction, |
0 | 108 const Dictionary& parameters); |
109 }; | |
110 } |