Mercurial > hg > orthanc-databases
comparison Framework/Odbc/OdbcResult.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 | |
children | 16aac0287485 |
comparison
equal
deleted
inserted
replaced
328:6a49c495c940 | 329:b5fb8b77ce4d |
---|---|
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-2021 Osimis S.A., Belgium | |
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 #include "OdbcStatement.h" | |
25 | |
26 #include "../Common/IResult.h" | |
27 | |
28 #include <Compatibility.h> | |
29 | |
30 #include <sqltypes.h> | |
31 #include <vector> | |
32 | |
33 | |
34 namespace OrthancDatabases | |
35 { | |
36 class OdbcResult : public IResult | |
37 { | |
38 private: | |
39 OdbcStatement& statement_; | |
40 Dialect dialect_; | |
41 bool first_; | |
42 bool done_; | |
43 std::vector<SQLLEN> types_; | |
44 std::vector<std::string> typeNames_; | |
45 std::vector<IValue*> values_; | |
46 | |
47 void LoadFirst(); | |
48 | |
49 void SetValue(size_t index, | |
50 IValue* value); | |
51 | |
52 void ReadString(std::string& target, | |
53 size_t column, | |
54 bool isBinary); | |
55 | |
56 public: | |
57 OdbcResult(OdbcStatement& statement, | |
58 Dialect dialect); | |
59 | |
60 virtual ~OdbcResult(); | |
61 | |
62 virtual void SetExpectedType(size_t field, | |
63 ValueType type) ORTHANC_OVERRIDE; | |
64 | |
65 virtual bool IsDone() const ORTHANC_OVERRIDE; | |
66 | |
67 virtual void Next() ORTHANC_OVERRIDE; | |
68 | |
69 virtual size_t GetFieldsCount() const ORTHANC_OVERRIDE | |
70 { | |
71 return values_.size(); | |
72 } | |
73 | |
74 virtual const IValue& GetField(size_t field) const ORTHANC_OVERRIDE; | |
75 }; | |
76 } |