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