sqlite3-statement.hpp
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
22 #ifndef NDN_UTIL_SQLITE3_STATEMENT_HPP
23 #define NDN_UTIL_SQLITE3_STATEMENT_HPP
24 
25 #include "../encoding/block.hpp"
26 #include <string>
27 
28 struct sqlite3;
29 struct sqlite3_stmt;
30 
31 namespace ndn {
32 namespace util {
33 
38 class Sqlite3Statement : noncopyable
39 {
40 public:
47  Sqlite3Statement(sqlite3* database, const std::string& statement);
48 
53 
63  int
64  bind(int index, const char* value, size_t size, void(*destructor)(void*));
65 
74  int
75  bind(int index, const std::string& value, void(*destructor)(void*));
76 
86  int
87  bind(int index, const void* value, size_t size, void(*destructor)(void*));
88 
97  int
98  bind(int index, const Block& block, void(*destructor)(void*));
99 
107  int
108  bind(int index, int number);
109 
113  std::string
114  getString(int column);
115 
119  Block
120  getBlock(int column);
121 
125  int
126  getInt(int column);
127 
131  const uint8_t*
132  getBlob(int column);
133 
137  int
138  getSize(int column);
139 
143  int
144  step();
145 
149  operator sqlite3_stmt*();
150 
151 private:
152  sqlite3_stmt* m_stmt;
153 };
154 
155 } // namespace util
156 } // namespace ndn
157 
158 #endif // NDN_UTIL_SQLITE3_STATEMENT_HPP
Copyright (c) 2013-2017 Regents of the University of California.
Definition: common.hpp:66
int getSize(int column)
get the size of column.
~Sqlite3Statement()
finalize the statement
Represents a TLV element of NDN packet format.
Definition: block.hpp:42
Sqlite3Statement(sqlite3 *database, const std::string &statement)
initialize and prepare Sqlite3 statement
Block getBlock(int column)
get a block from column.
const uint8_t * getBlob(int column)
get a pointer of byte blob from column.
int bind(int index, const char *value, size_t size, void(*destructor)(void *))
bind a string to the statement
std::string getString(int column)
get a string from column.
int step()
wrapper of sqlite3_step
wrap an SQLite3 prepared statement
int getInt(int column)
get an integer from column.