Mercurial > hg > orthanc-databases
annotate Framework/PostgreSQL/PostgreSQLResult.h @ 329:b5fb8b77ce4d
initial commit of ODBC framework
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Tue, 10 Aug 2021 20:08:53 +0200 |
parents | 483af3f35a4b |
children | 16aac0287485 |
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 | |
193
3236894320d6
upgrade to year 2021
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
140
diff
changeset
|
5 * Copyright (C) 2017-2021 Osimis S.A., Belgium |
0 | 6 * |
7 * This program is free software: you can redistribute it and/or | |
8 * modify it under the terms of the GNU Affero General Public License | |
9 * as published by the Free Software Foundation, either version 3 of | |
10 * the License, or (at your option) any later version. | |
11 * | |
12 * This program is distributed in the hope that it will be useful, but | |
13 * WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
15 * Affero General Public License for more details. | |
16 * | |
17 * You should have received a copy of the GNU Affero General Public License | |
18 * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
19 **/ | |
20 | |
21 | |
22 #pragma once | |
23 | |
24 #if ORTHANC_ENABLE_POSTGRESQL != 1 | |
25 # error PostgreSQL support must be enabled to use this file | |
26 #endif | |
27 | |
28 #include "PostgreSQLStatement.h" | |
29 | |
30 namespace OrthancDatabases | |
31 { | |
32 class PostgreSQLResult : public boost::noncopyable | |
33 { | |
34 private: | |
246
483af3f35a4b
turning ResultFileValue into a base class, and implement its primitives for PostgreSQL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
193
diff
changeset
|
35 class LargeObjectResult; |
483af3f35a4b
turning ResultFileValue into a base class, and implement its primitives for PostgreSQL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
193
diff
changeset
|
36 |
0 | 37 void *result_; /* Object of type "PGresult*" */ |
38 int position_; | |
39 PostgreSQLDatabase& database_; | |
40 unsigned int columnsCount_; | |
41 | |
42 void Clear(); | |
43 | |
44 void CheckDone(); | |
45 | |
46 void CheckColumn(unsigned int column, /*Oid*/ unsigned int expectedType) const; | |
47 | |
48 public: | |
49 explicit PostgreSQLResult(PostgreSQLStatement& statement); | |
50 | |
46
6a574d810b98
Compatibility with MySQL 8.0
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
0
diff
changeset
|
51 ~PostgreSQLResult(); |
0 | 52 |
53 void Next(); | |
54 | |
55 bool IsDone() const | |
56 { | |
57 return result_ == NULL; | |
58 } | |
59 | |
60 unsigned int GetColumnsCount() const | |
61 { | |
62 return columnsCount_; | |
63 } | |
64 | |
65 bool IsNull(unsigned int column) const; | |
66 | |
67 bool GetBoolean(unsigned int column) const; | |
68 | |
69 int GetInteger(unsigned int column) const; | |
70 | |
71 int64_t GetInteger64(unsigned int column) const; | |
72 | |
73 std::string GetString(unsigned int column) const; | |
74 | |
246
483af3f35a4b
turning ResultFileValue into a base class, and implement its primitives for PostgreSQL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
193
diff
changeset
|
75 std::string GetLargeObjectOid(unsigned int column) const; |
0 | 76 |
246
483af3f35a4b
turning ResultFileValue into a base class, and implement its primitives for PostgreSQL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
193
diff
changeset
|
77 void GetLargeObjectContent(std::string& content, |
483af3f35a4b
turning ResultFileValue into a base class, and implement its primitives for PostgreSQL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
193
diff
changeset
|
78 unsigned int column) const; |
0 | 79 |
80 IValue* GetValue(unsigned int column) const; | |
81 }; | |
82 } |