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

46 lines
1.3 KiB
C++
Raw Normal View History

2014-11-19 00:25:21 +08:00
#pragma once
#include "acl_cpp/acl_cpp_define.hpp"
#include "acl_cpp/db/db_pool.hpp"
namespace acl {
class db_handle;
class ACL_CPP_API mysql_pool : public acl::db_pool
{
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>)
*/
mysql_pool(const char* dbaddr, const char* dbname,
const char* dbuser, const char* dbpass,
int dblimit = 64, unsigned long dbflags = 0,
bool auto_commit = true, int conn_timeout = 60,
int rw_timeout = 60);
~mysql_pool();
protected:
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E9BAAF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݿ<EFBFBD><DDBF><EFBFBD><EFBFBD>Ӿ<EFBFBD><D3BE><EFBFBD>
virtual db_handle* create();
private:
char* dbaddr_; // <20><><EFBFBD>ݿ<EFBFBD><DDBF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ
char* dbname_; // <20><><EFBFBD>ݿ<EFBFBD><DDBF><EFBFBD>
char* dbuser_; // <20><><EFBFBD>ݿ<EFBFBD><DDBF>˺<EFBFBD>
char* dbpass_; // <20><><EFBFBD>ݿ<EFBFBD><DDBF>˺<EFBFBD><CBBA><EFBFBD><EFBFBD><EFBFBD>
unsigned long dbflags_;
int conn_timeout_;
int rw_timeout_;
bool auto_commit_;
};
} // namespace acl