Botan  2.6.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 
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 final : 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  std::string get_str(int column) override;
42  size_t get_size_t(int column) override;
43 
44  size_t spin() override;
45  bool step() override;
46 
47  Sqlite3_Statement(sqlite3* db, const std::string& base_sql);
48  ~Sqlite3_Statement();
49  private:
50  sqlite3_stmt* m_stmt;
51  };
52 
53  sqlite3* m_db;
54  };
55 
56 }
57 
58 #endif
#define BOTAN_PUBLIC_API(maj, min)
Definition: compiler.h:27
Definition: alg_id.cpp:13