|
| bool | init (const xarg_db &adbarg) |
| | 初始化连接池,创建指定数量的PostgreSQL连接。
|
| std::shared_ptr< npostgresql > | get (int32_t aindex) |
| | 按索引获取一个PostgreSQL连接实例。
|
|
|
static npostgresql_pool & | instance () |
◆ get()
| std::shared_ptr< npostgresql > ngl::npostgresql_pool::get |
( |
int32_t | aindex | ) |
|
按索引获取一个PostgreSQL连接实例。
从连接池获取PostgreSQL连接
- Parameters
-
- Returns
- std::shared_ptr<npostgresql> 连接智能指针,索引越界返回nullptr
索引-1使用信号量保护的释放连接(单实例互斥), 其他索引直接返回对应槽位的连接。
- Parameters
-
- Returns
- npostgresql智能指针,索引无效时返回nullptr
◆ init()
| bool ngl::npostgresql_pool::init |
( |
const xarg_db & | adbarg | ) |
|
初始化连接池,创建指定数量的PostgreSQL连接。
初始化PostgreSQL连接池
- Parameters
-
- Returns
- true 初始化成功
-
false 初始化失败(任一连接创建失败)
根据tab_servers配置的线程数创建等量的npostgresql实例, 并额外创建一个释放连接用于后台任务。
- Parameters
-
- Return values
-
| true | 初始化成功 |
| false | 重复初始化或任何连接失败 |
The documentation for this class was generated from the following files: