comparison OrthancFramework/Sources/SQLite/FunctionContext.h @ 4044:d25f4c0fa160 framework

splitting code into OrthancFramework and OrthancServer
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 10 Jun 2020 20:30:34 +0200
parents Core/SQLite/FunctionContext.h@f9863630ec7f
children 50b0c69b653a
comparison
equal deleted inserted replaced
4043:6c6239aec462 4044:d25f4c0fa160
1 /**
2 * Orthanc - A Lightweight, RESTful DICOM Store
3 *
4 * Copyright (C) 2012-2016 Sebastien Jodogne <s.jodogne@orthanc-labs.com>,
5 * Medical Physics Department, CHU of Liege, Belgium
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions are
9 * met:
10 *
11 * * Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * * Redistributions in binary form must reproduce the above
14 * copyright notice, this list of conditions and the following disclaimer
15 * in the documentation and/or other materials provided with the
16 * distribution.
17 * * Neither the name of the CHU of Liege, nor the names of its
18 * contributors may be used to endorse or promote products derived
19 * from this software without specific prior written permission.
20 *
21 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
24 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
25 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
26 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
27 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
29 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32 **/
33
34
35 #pragma once
36
37 #include "Statement.h"
38
39 namespace Orthanc
40 {
41 namespace SQLite
42 {
43 class ORTHANC_PUBLIC FunctionContext : public NonCopyable
44 {
45 friend class Connection;
46
47 private:
48 struct sqlite3_context* context_;
49 unsigned int argc_;
50 Internals::SQLiteValue** argv_;
51
52 void CheckIndex(unsigned int index) const;
53
54 public:
55 FunctionContext(struct sqlite3_context* context,
56 int argc,
57 Internals::SQLiteValue** argv);
58
59 ColumnType GetColumnType(unsigned int index) const;
60
61 unsigned int GetParameterCount() const
62 {
63 return argc_;
64 }
65
66 int GetIntValue(unsigned int index) const;
67
68 int64_t GetInt64Value(unsigned int index) const;
69
70 double GetDoubleValue(unsigned int index) const;
71
72 std::string GetStringValue(unsigned int index) const;
73
74 bool IsNullValue(unsigned int index) const;
75
76 void SetNullResult();
77
78 void SetIntResult(int value);
79
80 void SetDoubleResult(double value);
81
82 void SetStringResult(const std::string& str);
83 };
84 }
85 }