acl/lib_acl_cpp/include/acl_cpp/db/mysql_pool.hpp

53 lines
1.5 KiB
C++
Raw Normal View History

#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
#if !defined(ACL_CLIENT_ONLY) && !defined(ACL_DB_DISABLE)
2014-11-19 00:25:21 +08:00
namespace acl {
class db_handle;
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:
/**
* <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,
int dblimit = 64, unsigned long dbflags = 0,
2014-11-19 00:25:21 +08:00
bool auto_commit = true, int conn_timeout = 60,
int rw_timeout = 60, const char* charset = "utf8");
/**
* <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>
*/
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:
// <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:
mysql_conf* conf_;
2014-11-19 00:25:21 +08:00
};
} // namespace acl
#endif // !defined(ACL_CLIENT_ONLY) && !defined(ACL_DB_DISABLE)