2019-07-28 10:31:56 +08:00
|
|
|
|
#pragma once
|
2017-06-02 14:47:24 +08:00
|
|
|
|
#include "../acl_cpp_define.hpp"
|
|
|
|
|
#include "../db/db_pool.hpp"
|
2014-11-19 00:25:21 +08:00
|
|
|
|
|
2019-05-19 16:54:20 +08:00
|
|
|
|
#if !defined(ACL_CLIENT_ONLY) && !defined(ACL_DB_DISABLE)
|
2019-05-18 21:19:21 +08:00
|
|
|
|
|
2014-11-19 00:25:21 +08:00
|
|
|
|
namespace acl {
|
|
|
|
|
|
|
|
|
|
class db_handle;
|
2015-10-25 14:15:07 +08:00
|
|
|
|
class mysql_conf;
|
2014-11-19 00:25:21 +08:00
|
|
|
|
|
2015-08-12 16:48:24 +08:00
|
|
|
|
class ACL_CPP_API mysql_pool : public db_pool
|
2014-11-19 00:25:21 +08:00
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
/**
|
2019-07-28 10:31:56 +08:00
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD> mysql <EFBFBD><EFBFBD><EFBFBD>ݿ<EFBFBD>ʱ<EFBFBD>Ĺ<EFBFBD><EFBFBD>캯<EFBFBD><EFBFBD>
|
|
|
|
|
* @param dbaddr {const char*} mysql <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʽ<EFBFBD><EFBFBD>IP:PORT<EFBFBD><EFBFBD>
|
|
|
|
|
* <EFBFBD><EFBFBD> UNIX ƽ̨<EFBFBD>¿<EFBFBD><EFBFBD><EFBFBD>Ϊ UNIX <EFBFBD><EFBFBD><EFBFBD>ӿ<EFBFBD>
|
|
|
|
|
* @param dbname {const char*} <EFBFBD><EFBFBD><EFBFBD>ݿ<EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @param dbuser {const char*} <EFBFBD><EFBFBD><EFBFBD>ݿ<EFBFBD><EFBFBD>û<EFBFBD>
|
|
|
|
|
* @param dbpass {const char*} <EFBFBD><EFBFBD><EFBFBD>ݿ<EFBFBD><EFBFBD>û<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @param dblimit {int} <EFBFBD><EFBFBD><EFBFBD>ݿ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ӳص<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @param dbflags {unsigned long} mysql <EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ
|
|
|
|
|
* @param auto_commit {bool} <EFBFBD>Ƿ<EFBFBD><EFBFBD>Զ<EFBFBD><EFBFBD>ύ
|
|
|
|
|
* @param conn_timeout {int} <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݿⳬʱʱ<EFBFBD><EFBFBD>(<EFBFBD><EFBFBD>)
|
|
|
|
|
* @param rw_timeout {int} <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݿ<EFBFBD>ͨ<EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD>IOʱ<EFBFBD><EFBFBD>(<EFBFBD><EFBFBD>)
|
|
|
|
|
* @param charset {const char*} <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݿ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><EFBFBD><EFBFBD>(utf8, gbk, ...)
|
2014-11-19 00:25:21 +08:00
|
|
|
|
*/
|
|
|
|
|
mysql_pool(const char* dbaddr, const char* dbname,
|
|
|
|
|
const char* dbuser, const char* dbpass,
|
2015-10-25 14:15:07 +08:00
|
|
|
|
int dblimit = 64, unsigned long dbflags = 0,
|
2014-11-19 00:25:21 +08:00
|
|
|
|
bool auto_commit = true, int conn_timeout = 60,
|
2015-10-25 14:15:07 +08:00
|
|
|
|
int rw_timeout = 60, const char* charset = "utf8");
|
|
|
|
|
|
|
|
|
|
/**
|
2019-07-28 10:31:56 +08:00
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD>캯<EFBFBD><EFBFBD>
|
|
|
|
|
* @param conf {const mysql_conf&} mysql <EFBFBD><EFBFBD><EFBFBD>ݿ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ö<EFBFBD><EFBFBD><EFBFBD>
|
2015-10-25 14:15:07 +08:00
|
|
|
|
*/
|
|
|
|
|
mysql_pool(const mysql_conf& conf);
|
2014-11-19 00:25:21 +08:00
|
|
|
|
~mysql_pool();
|
2015-08-12 16:48:24 +08:00
|
|
|
|
|
2014-11-19 00:25:21 +08:00
|
|
|
|
protected:
|
2019-07-28 10:31:56 +08:00
|
|
|
|
// <20><><EFBFBD><EFBFBD> connect_pool <20><><EFBFBD>麯<EFBFBD><E9BAAF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݿ<EFBFBD><DDBF><EFBFBD><EFBFBD>Ӿ<EFBFBD><D3BE><EFBFBD>
|
2015-08-12 16:48:24 +08:00
|
|
|
|
connect_client* create_connect();
|
|
|
|
|
|
2014-11-19 00:25:21 +08:00
|
|
|
|
private:
|
2015-10-25 14:15:07 +08:00
|
|
|
|
mysql_conf* conf_;
|
2014-11-19 00:25:21 +08:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
} // namespace acl
|
2019-05-18 21:19:21 +08:00
|
|
|
|
|
2019-05-19 16:54:20 +08:00
|
|
|
|
#endif // !defined(ACL_CLIENT_ONLY) && !defined(ACL_DB_DISABLE)
|