1#ifndef MSTL_DATABASE_MYSQL_PREPARED_RESULT_HPP__
2#define MSTL_DATABASE_MYSQL_PREPARED_RESULT_HPP__
3#ifdef MSTL_SUPPORT_MYSQL__
4#include "../../core/config/undef_cmacro.hpp"
5#include "MSTL/database/db_interface.hpp"
12class MSTL_API mysql_prepared_result final :
public idb_prepared_result {
14 ::MYSQL_STMT* stmt_ =
nullptr;
15 ::MYSQL_RES* metadata_ =
nullptr;
18 bool has_current_row_ =
false;
29 void initialize_bindings()
const;
30 static size_t get_buffer_size(::enum_field_types type);
33 explicit mysql_prepared_result(::MYSQL_STMT* stmt);
34 ~mysql_prepared_result()
override;
36 mysql_prepared_result(
const mysql_prepared_result&) =
delete;
37 mysql_prepared_result& operator =(
const mysql_prepared_result&) =
delete;
39 bool empty()
const override {
return row_count_ == 0; }
42 size_type row_count()
const override {
return row_count_; }
43 size_type column_count()
const override {
return column_count_; }
45 const vector<string_view>& column_names()
const override {
return *column_names_; }
46 const vector<::enum_field_types>& column_types()
const {
return *column_types_; }
48 string_view
get(size_type n)
const override;
49 bool get_bool(size_type n)
const override;
50 int8_t get_int8(size_type n)
const override;
51 int16_t get_int16(size_type n)
const override;
52 int32_t get_int32(size_type n)
const override;
53 int64_t get_int64(size_type n)
const override;
54 float32_t get_float32(size_type n)
const override;
55 float64_t get_float64(size_type n)
const override;
56 decimal_t get_decimal(size_type n)
const override;
57 vector<char> get_blob(size_type n)
const override;
58 string get_set(size_type n)
const override;
59 uint64_t get_bit(size_type n)
const override;
60 date get_date(size_type n)
const override;
61 time get_time(size_type n)
const override;
62 datetime get_datetime(size_type n)
const override;
63 timestamp get_timestamp(size_type n)
const override;
64 string get_string(size_type n)
const override {
return string(
get(n)); }
65 string_view get_enum(size_type n)
const override {
return get(n); }
MSTL_ALWAYS_INLINE enable_if_t< is_void_v< T >, future_result_t< T > > get(future< T > &f)
通用future结果获取函数
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位无符号整数类型
signed char int8_t
8位有符号整数类型
constexpr Iterator next(Iterator iter, iter_difference_t< Iterator > n=1)
获取迭代器的后一个位置
#define MSTL_END_NAMESPACE__
结束全局命名空间MSTL
#define MSTL_BEGIN_NAMESPACE__
开始全局命名空间MSTL
MSTL_NODISCARD MSTL_ALWAYS_INLINE constexpr bool empty(const Container &cont) noexcept(noexcept(cont.empty()))
检查容器是否为空
MSTL_CONSTEXPR20 unique_ptr< T > make_unique(Args &&... args)
创建unique_ptr