MySQL连接管理器,提供面向Actor数据的CRUD操作。
More...
#include <nmysql_manage.h>
|
| static bool | init () |
| | 初始化管理器,从配置读取序列化模式。
|
| template<typename T> |
| static bool | save (nmysql *adb, T *adata) |
| | 将单个Actor数据保存到MySQL(UPSERT)。
|
| template<typename T> |
| static bool | save (nmysql *adb, i64_actorid aid) |
| | 按Actor ID从缓存加载数据并保存到MySQL。
|
| template<typename T> |
| static bool | save (nmysql *adb) |
| | 将指定类型的所有缓存数据批量保存到MySQL。
|
| template<typename T> |
| static bool | del (nmysql *adb, i64_actorid aid) |
| | 从MySQL删除指定Actor的数据记录。
|
| static const char * | where_area () |
| | 获取区域过滤SQL条件片段。
|
| template<typename T> |
| static bool | select (nmysql *adb, i64_actorid aid) |
| | 从MySQL加载单个Actor数据到缓存。
|
| template<typename T> |
| static bool | select (nmysql *adb) |
| | 从MySQL加载指定类型的全部可见区域数据到缓存。
|
| template<typename T> |
| static bool | select (nmysql *adb, std::set< int64_t > &aidset) |
| | 从MySQL加载指定类型的可见区域ID集合(仅ID,不含数据)。
|
MySQL连接管理器,提供面向Actor数据的CRUD操作。
将查询路由到正确的连接池,支持序列化存储和区域过滤查询。 所有方法均为静态方法,禁止实例化。
◆ del()
从MySQL删除指定Actor的数据记录。
- Template Parameters
-
- Parameters
-
- Returns
- true 删除成功
-
false 删除失败
◆ init()
| bool ngl::nmysql_manage::init |
( |
| ) |
|
|
inlinestatic |
初始化管理器,从配置读取序列化模式。
- Returns
- true 初始化成功
-
false 配置缺失或读取失败
◆ save() [1/3]
template<typename T>
| bool ngl::nmysql_manage::save |
( |
nmysql * | adb | ) |
|
|
inlinestatic |
将指定类型的所有缓存数据批量保存到MySQL。
- Template Parameters
-
- Parameters
-
- Returns
- true 始终返回true
◆ save() [2/3]
按Actor ID从缓存加载数据并保存到MySQL。
- Template Parameters
-
- Parameters
-
- Returns
- true 保存成功
-
false 数据未找到或保存失败
◆ save() [3/3]
template<typename T>
| bool ngl::nmysql_manage::save |
( |
nmysql * | adb, |
|
|
T * | adata ) |
|
inlinestatic |
将单个Actor数据保存到MySQL(UPSERT)。
- Template Parameters
-
- Parameters
-
| adb | MySQL连接实例 |
| adata | 要保存的数据指针 |
- Returns
- true 保存成功
-
false 保存失败
◆ select() [1/3]
template<typename T>
| bool ngl::nmysql_manage::select |
( |
nmysql * | adb | ) |
|
|
inlinestatic |
从MySQL加载指定类型的全部可见区域数据到缓存。
- Template Parameters
-
- Parameters
-
- Returns
- true 加载成功
-
false 加载失败
◆ select() [2/3]
从MySQL加载单个Actor数据到缓存。
- Template Parameters
-
- Parameters
-
- Returns
- true 加载成功
-
false 加载失败
◆ select() [3/3]
template<typename T>
| bool ngl::nmysql_manage::select |
( |
nmysql * | adb, |
|
|
std::set< int64_t > & | aidset ) |
|
inlinestatic |
从MySQL加载指定类型的可见区域ID集合(仅ID,不含数据)。
- Template Parameters
-
- Parameters
-
| adb | MySQL连接实例 |
| aidset | 输出参数,存储加载到的ID集合 |
- Returns
- true 加载成功
-
false 加载失败
◆ where_area()
| const char * ngl::nmysql_manage::where_area |
( |
| ) |
|
|
inlinestatic |
获取区域过滤SQL条件片段。
- Returns
- const char* SQL WHERE子句中的区域过滤条件
- Note
- 使用std::call_once确保只初始化一次。
The documentation for this class was generated from the following files: