NexusForce 1.0.0
A Modern C++ Library with extended functionality, web components, and utility libraries
载入中...
搜索中...
未找到
mysql_prepared_result.hpp
浏览该文件的文档.
1#ifndef NEFORCE_DATABASE_MYSQL_PREPARED_RESULT_HPP__
2#define NEFORCE_DATABASE_MYSQL_PREPARED_RESULT_HPP__
3
10
11#ifdef NEFORCE_SUPPORT_MYSQL
12# include <mysql/mysql.h>
14NEFORCE_BEGIN_NAMESPACE__
15
21
27
40class NEFORCE_API mysql_prepared_result final : public idb_prepared_result {
41private:
42 ::MYSQL_STMT* stmt_ = nullptr;
43 ::MYSQL_RES* metadata_ = nullptr;
44 uint32_t column_count_ = 0;
45 uint64_t row_count_ = 0;
46 bool has_current_row_ = false;
47
50
56
57 void initialize_bindings() const;
58
59public:
67 explicit mysql_prepared_result(::MYSQL_STMT* stmt);
68
75
77 mysql_prepared_result& operator=(const mysql_prepared_result&) = delete;
78
83 bool empty() const override { return row_count_ == 0; }
84
91 bool next() override;
92
97 size_type row_count() const override { return row_count_; }
98
103 size_type column_count() const override { return column_count_; }
104
109 const vector<string_view>& column_names() const override { return *column_names_; }
110
115 const vector<::enum_field_types>& column_types() const { return *column_types_; }
116
123 string_view get(size_type n) const override;
124
131 bool get_bool(size_type n) const override;
132
139 int16_t get_int16(size_type n) const override;
140
147 int32_t get_int32(size_type n) const override;
148
155 int64_t get_int64(size_type n) const override;
156
163 float32_t get_float32(size_type n) const override;
164
171 float64_t get_float64(size_type n) const override;
172
179 decimal_t get_decimal(size_type n) const override;
180
187 vector<char> get_blob(size_type n) const override;
188
195 uint64_t get_bit(size_type n) const override;
196
203 date get_date(size_type n) const override;
204
211 time get_time(size_type n) const override;
212
219 datetime get_datetime(size_type n) const override;
220
228};
229 // MySQL
231 // Database
233
234NEFORCE_END_NAMESPACE__
235#endif
236#endif // NEFORCE_DATABASE_MYSQL_PREPARED_RESULT_HPP__
日期类
日期时间类
uint64_t get_bit(size_type n) const override
获取BIT位字段值
size_type column_count() const override
获取结果集列数
vector< char > get_blob(size_type n) const override
获取BLOB二进制数据
size_type row_count() const override
获取结果集行数
int32_t get_int32(size_type n) const override
获取32位整数值
timestamp get_timestamp(size_type n) const override
获取时间戳值
bool get_bool(size_type n) const override
获取布尔值
bool empty() const override
检查结果集是否为空
decimal_t get_decimal(size_type n) const override
获取十进制值
const vector<::enum_field_types > & column_types() const
获取列类型列表
bool next() override
移动到下一行
float32_t get_float32(size_type n) const override
获取32位浮点值
date get_date(size_type n) const override
获取日期值
string_view get(size_type n) const override
获取字符串值
int16_t get_int16(size_type n) const override
获取16位整数值
int64_t get_int64(size_type n) const override
获取64位整数值
float64_t get_float64(size_type n) const override
获取64位浮点值
mysql_prepared_result(::MYSQL_STMT *stmt)
构造函数
const vector< string_view > & column_names() const override
获取列名列表
~mysql_prepared_result() override
析构函数
datetime get_datetime(size_type n) const override
获取日期时间值
time get_time(size_type n) const override
获取时间值
时间类
时间戳类
独占智能指针
动态大小数组容器
数据库抽象接口层
float float32_t
32位单精度浮点数类型
unsigned int uint32_t
32位无符号整数类型
long double decimal_t
扩展精度浮点数类型
long long int64_t
64位有符号整数类型
double float64_t
64位双精度浮点数类型
unsigned long long uint64_t
64位无符号整数类型
short int16_t
16位有符号整数类型
int int32_t
32位有符号整数类型
basic_string_view< char > string_view
字符字符串视图
NEFORCE_CONSTEXPR20 unique_ptr< T > make_unique(Args &&... args)
创建unique_ptr
预处理语句执行结果
size_t size_type
大小类型