1#ifndef NEFORCE_DATABASE_DB_CONFIG_HPP__
2#define NEFORCE_DATABASE_DB_CONFIG_HPP__
14NEFORCE_BEGIN_NAMESPACE__
26struct database_typecast_exception final : database_exception {
27 explicit database_typecast_exception(
const char* info =
"Database Type Mismatch.",
const char*
type = static_type,
28 const int code = 0) noexcept :
29 database_exception(info,
type,
code) {}
31 explicit database_typecast_exception(
const exception& e) :
32 database_exception(e) {}
34 ~database_typecast_exception()
override =
default;
35 static constexpr auto static_type =
"database_typecast_exception";
42struct database_stmt_exception final : database_exception {
43 explicit database_stmt_exception(
const char* info =
"Database Statement Operations Error.",
44 const char*
type = static_type,
const int code = 0) noexcept :
45 database_exception(info,
type,
code) {}
47 explicit database_stmt_exception(
const exception& e) :
48 database_exception(e) {}
50 ~database_stmt_exception()
override =
default;
51 static constexpr auto static_type =
"database_prepared_stmt_exception";
70#ifdef NEFORCE_SUPPORT_MYSQL
73#ifdef NEFORCE_SUPPORT_SQLITE3
76#ifdef NEFORCE_SUPPORT_HIREDIS
79#ifdef NEFORCE_SUPPORT_POSTGRESQL
99#ifdef NEFORCE_SUPPORT_POSTGRESQL
113#ifdef NEFORCE_SUPPORT_MYSQL
127#ifdef NEFORCE_SUPPORT_SQLITE3
139#ifdef NEFORCE_SUPPORT_HIREDIS
155NEFORCE_END_NAMESPACE__
unsigned char uint8_t
8位无符号整数类型
@ POSTGRESQL
PostgreSQL数据库
static db_config for_postgresql(const string &db="postgres")
创建PostgreSQL数据库配置
static db_config for_sqlite(const string &file)
创建SQLite3数据库配置
static db_config for_mysql(const string &db)
创建MySQL数据库配置
static db_config for_redis(const string &db)
创建Redis数据库配置
exception(const char *info=static_type, const char *type=static_type, const int code=0)
构造函数
NEFORCE_NODISCARD int code() const noexcept
获取异常码
NEFORCE_NODISCARD const char * type() const noexcept
获取异常类型