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

92 lines
1.8 KiB
C++
Raw Normal View History

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);
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);
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_;
}
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_;
}
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_;
}
const char* get_charset() const
{
return charset_;
}
2015-08-12 16:48:24 +08:00
private:
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>
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>
char* charset_; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݿ<EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD>
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