2015-08-12 16:48:24 +08:00
|
|
|
|
#pragma once
|
|
|
|
|
#include "acl_cpp/acl_cpp_define.hpp"
|
|
|
|
|
|
|
|
|
|
namespace acl {
|
|
|
|
|
|
|
|
|
|
class ACL_CPP_API mysql_conf
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
mysql_conf(const char* dbaddr, const char* dbname);
|
|
|
|
|
mysql_conf(const mysql_conf& conf);
|
|
|
|
|
~mysql_conf();
|
|
|
|
|
|
|
|
|
|
mysql_conf& set_dbuser(const char* dbuser);
|
|
|
|
|
mysql_conf& set_dbpass(const char* dbpass);
|
2015-08-14 17:28:30 +08:00
|
|
|
|
mysql_conf& set_dblimit(size_t dblimit);
|
2015-08-12 16:48:24 +08:00
|
|
|
|
mysql_conf& set_dbflags(unsigned long dbflags);
|
|
|
|
|
mysql_conf& set_auto_commit(bool on);
|
|
|
|
|
mysql_conf& set_conn_timeout(int timeout);
|
|
|
|
|
mysql_conf& set_rw_timeout(int timeout);
|
2015-10-25 14:15:07 +08:00
|
|
|
|
mysql_conf& set_charset(const char* charset);
|
2015-08-12 16:48:24 +08:00
|
|
|
|
|
|
|
|
|
const char* get_dbaddr() const
|
|
|
|
|
{
|
|
|
|
|
return dbaddr_;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const char* get_dbname() const
|
|
|
|
|
{
|
|
|
|
|
return dbname_;
|
|
|
|
|
}
|
|
|
|
|
|
2015-10-25 14:15:07 +08:00
|
|
|
|
const char* get_dbkey() const
|
|
|
|
|
{
|
|
|
|
|
return dbkey_;
|
|
|
|
|
}
|
|
|
|
|
|
2015-08-12 16:48:24 +08:00
|
|
|
|
const char* get_dbuser() const
|
|
|
|
|
{
|
|
|
|
|
return dbuser_;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const char* get_dbpass() const
|
|
|
|
|
{
|
|
|
|
|
return dbpass_;
|
|
|
|
|
}
|
|
|
|
|
|
2015-08-14 17:28:30 +08:00
|
|
|
|
size_t get_dblimit() const
|
2015-08-12 16:48:24 +08:00
|
|
|
|
{
|
|
|
|
|
return dblimit_;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
unsigned long get_dbflags() const
|
|
|
|
|
{
|
|
|
|
|
return dbflags_;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool get_auto_commit() const
|
|
|
|
|
{
|
|
|
|
|
return auto_commit_;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int get_conn_timeout() const
|
|
|
|
|
{
|
|
|
|
|
return conn_timeout_;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int get_rw_timeout() const
|
|
|
|
|
{
|
|
|
|
|
return rw_timeout_;
|
|
|
|
|
}
|
|
|
|
|
|
2015-10-25 14:15:07 +08:00
|
|
|
|
const char* get_charset() const
|
|
|
|
|
{
|
|
|
|
|
return charset_;
|
|
|
|
|
}
|
|
|
|
|
|
2015-08-12 16:48:24 +08:00
|
|
|
|
private:
|
2015-10-25 14:15:07 +08:00
|
|
|
|
char* dbaddr_; // <20><><EFBFBD>ݿ<EFBFBD><DDBF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ
|
2015-08-12 16:48:24 +08:00
|
|
|
|
char* dbname_; // <20><><EFBFBD>ݿ<EFBFBD><DDBF><EFBFBD>
|
2015-10-25 14:15:07 +08:00
|
|
|
|
char* dbkey_; // dbname@dbaddr
|
2015-08-12 16:48:24 +08:00
|
|
|
|
char* dbuser_; // <20><><EFBFBD>ݿ<EFBFBD><DDBF>˺<EFBFBD>
|
|
|
|
|
char* dbpass_; // <20><><EFBFBD>ݿ<EFBFBD><DDBF>˺<EFBFBD><CBBA><EFBFBD><EFBFBD><EFBFBD>
|
2015-10-25 14:15:07 +08:00
|
|
|
|
char* charset_; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݿ<EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD>
|
2015-08-14 17:28:30 +08:00
|
|
|
|
size_t dblimit_; // <20><><EFBFBD>ݿ<EFBFBD><DDBF><EFBFBD><EFBFBD>ӳ<EFBFBD><D3B3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2015-08-12 16:48:24 +08:00
|
|
|
|
unsigned long dbflags_; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݿ<EFBFBD>ʱ<EFBFBD>ı<EFBFBD>־λ
|
|
|
|
|
bool auto_commit_; // <20>Ƿ<EFBFBD><C7B7>Զ<EFBFBD><D4B6>ύ<EFBFBD>ĺ<DEB8><C4BA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
int conn_timeout_; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݿ<EFBFBD><DDBF>ij<EFBFBD>ʱʱ<CAB1><CAB1>
|
|
|
|
|
int rw_timeout_; // <20><><EFBFBD><EFBFBD><EFBFBD>ݿ<EFBFBD>ͨ<EFBFBD>ŵij<C5B5>ʱʱ<CAB1><CAB1>
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
} // namespace acl
|