Botan  2.1.0
Crypto and TLS for C++11
sqlite3.h
Go to the documentation of this file.
1 /*
2 * SQLite3 wrapper
3 * (C) 2012,2014 Jack Lloyd
4 *
5 * Botan is released under the Simplified BSD License (see license.txt)
6 */
7 
8 #ifndef BOTAN_UTILS_SQLITE3_H__
9 #define BOTAN_UTILS_SQLITE3_H__
10 
11 #include <botan/database.h>
12 
13 class sqlite3;
14 class sqlite3_stmt;
15 
16 namespace Botan {
17 
18 class BOTAN_DLL Sqlite3_Database : public SQL_Database
19  {
20  public:
21  Sqlite3_Database(const std::string& file);
22 
24 
25  size_t row_count(const std::string& table_name) override;
26 
27  void create_table(const std::string& table_schema) override;
28 
29  std::shared_ptr<Statement> new_statement(const std::string& sql) const override;
30  private:
31  class Sqlite3_Statement : public Statement
32  {
33  public:
34  void bind(int column, const std::string& val) override;
35  void bind(int column, size_t val) override;
36  void bind(int column, std::chrono::system_clock::time_point time) override;
37  void bind(int column, const std::vector<uint8_t>& val) override;
38  void bind(int column, const uint8_t* data, size_t len) override;
39 
40  std::pair<const uint8_t*, size_t> get_blob(int column) override;
41  size_t get_size_t(int column) override;
42 
43  size_t spin() override;
44  bool step() override;
45 
46  Sqlite3_Statement(sqlite3* db, const std::string& base_sql);
47  ~Sqlite3_Statement();
48  private:
49  sqlite3_stmt* m_stmt;
50  };
51 
52  sqlite3* m_db;
53  };
54 
55 }
56 
57 #endif
Definition: alg_id.cpp:13