comparison Core/SQLite/FunctionContext.h @ 0:3959d33612cc

initial commit
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 19 Jul 2012 14:32:22 +0200
parents
children db4d996ea264
comparison
equal deleted inserted replaced
-1:000000000000 0:3959d33612cc
1 /**
2 * Palantir - A Lightweight, RESTful DICOM Store
3 * Copyright (C) 2012 Medical Physics Department, CHU of Liege,
4 * Belgium
5 *
6 * This program is free software: you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License as
8 * published by the Free Software Foundation, either version 3 of the
9 * License, or (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 **/
19
20
21 #pragma once
22
23 #include <boost/noncopyable.hpp>
24
25 #include "Statement.h"
26
27 struct sqlite3_context;
28 struct Mem; // This corresponds to the opaque type "sqlite3_value"
29
30 namespace Palantir
31 {
32 namespace SQLite
33 {
34 class FunctionContext : public boost::noncopyable
35 {
36 friend class Connection;
37
38 private:
39 struct sqlite3_context* context_;
40 unsigned int argc_;
41 struct ::Mem** argv_;
42
43 void CheckIndex(unsigned int index) const;
44
45 public:
46 FunctionContext(struct sqlite3_context* context,
47 int argc,
48 struct ::Mem** argv);
49
50 ColumnType GetColumnType(unsigned int index) const;
51
52 unsigned int GetParameterCount() const
53 {
54 return argc_;
55 }
56
57 int GetIntValue(unsigned int index) const;
58
59 double GetDoubleValue(unsigned int index) const;
60
61 std::string GetStringValue(unsigned int index) const;
62
63 void SetNullResult();
64
65 void SetIntResult(int value);
66
67 void SetDoubleResult(double value);
68
69 void SetStringResult(const std::string& str);
70 };
71 }
72 }