Botan  1.11.15
src/lib/vendor/sqlite3/sqlite3.h
Go to the documentation of this file.
00001 /*
00002 * SQLite3 wrapper
00003 * (C) 2012,2014 Jack Lloyd
00004 *
00005 * Botan is released under the Simplified BSD License (see license.txt)
00006 */
00007 
00008 #ifndef BOTAN_UTILS_SQLITE3_H__
00009 #define BOTAN_UTILS_SQLITE3_H__
00010 
00011 #include <botan/database.h>
00012 
00013 class sqlite3;
00014 class sqlite3_stmt;
00015 
00016 namespace Botan {
00017 
00018 class BOTAN_DLL Sqlite3_Database  : public SQL_Database
00019    {
00020    public:
00021       Sqlite3_Database(const std::string& file);
00022 
00023       ~Sqlite3_Database();
00024 
00025       size_t row_count(const std::string& table_name) override;
00026 
00027       void create_table(const std::string& table_schema) override;
00028 
00029       std::shared_ptr<Statement> new_statement(const std::string& sql) const override;
00030    private:
00031       class Sqlite3_Statement : public Statement
00032          {
00033          public:
00034             void bind(int column, const std::string& val) override;
00035             void bind(int column, size_t val) override;
00036             void bind(int column, std::chrono::system_clock::time_point time) override;
00037             void bind(int column, const std::vector<byte>& val) override;
00038 
00039             std::pair<const byte*, size_t> get_blob(int column) override;
00040             size_t get_size_t(int column) override;
00041 
00042             void spin() override;
00043             bool step() override;
00044 
00045             Sqlite3_Statement(sqlite3* db, const std::string& base_sql);
00046             ~Sqlite3_Statement();
00047          private:
00048             sqlite3_stmt* m_stmt;
00049          };
00050 
00051       sqlite3* m_db;
00052    };
00053 
00054 }
00055 
00056 #endif