1#ifndef NEFORCE_DATABASE_SQLITE_PREPARED_STATEMENT_HPP__
2#define NEFORCE_DATABASE_SQLITE_PREPARED_STATEMENT_HPP__
11#ifdef NEFORCE_SUPPORT_SQLITE3
12# ifdef NEFORCE_SUPPORT_SQLCIPHER
13# include <sqlcipher/sqlite3.h>
18NEFORCE_BEGIN_NAMESPACE__
51 ::sqlite3* db_ =
nullptr;
52 ::sqlite3_stmt* stmt_ =
nullptr;
56 bool prepared_ =
false;
57 mutable string last_error_;
64 void clear_bindings();
193 return db_ !=
nullptr ? ::sqlite3_errcode(db_) : 0;
201NEFORCE_END_NAMESPACE__
constexpr basic_string_view view(const size_type off, const size_type count=npos) const
获取子视图
constexpr view_type view() const noexcept
获取字符串视图
~sqlite_prepared_statement() override
析构函数
bool bind_param(uint32_t index, int32_t value) override
绑定32位整数参数
uint32_t param_count() const noexcept override
获取参数数量
bool bind_param(uint32_t index, const string &value) override
绑定字符串参数
sqlite_prepared_statement(sqlite_prepared_statement &&other) noexcept
移动构造函数
bool bind_param(uint32_t index, cbyte_view value) override
绑定二进制数据参数
bool bind_param(uint32_t index, string_view value) override
绑定字符串视图参数
unique_ptr< idb_tb_result > execute_query() override
执行查询语句
bool bind_param(uint32_t index, const char *value) override
绑定C字符串参数
bool bind_param(uint32_t index, int64_t value) override
绑定64位整数参数
bool execute() override
执行非查询语句
sqlite_prepared_statement & operator=(sqlite_prepared_statement &&other) noexcept
移动赋值运算符
bool bind_param(uint32_t index, float64_t value) override
绑定浮点数参数
sqlite_prepared_statement(::sqlite3 *db, const string &sql)
构造函数
uint32_t get_errno() const noexcept override
获取错误码
string_view get_error() const noexcept override
获取错误信息
unsigned int uint32_t
32位无符号整数类型
double float64_t
64位双精度浮点数类型
memory_view< const byte_t > cbyte_view
常量字节视图类型别名
basic_string_view< char > string_view
字符字符串视图