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

130 lines
2.4 KiB
C++
Raw Normal View History

2017-04-27 21:46:28 +08:00
#pragma once
2017-06-02 14:47:24 +08:00
#include "../acl_cpp_define.hpp"
2017-04-27 21:46:28 +08:00
namespace acl {
class ACL_CPP_API pgsql_conf
{
public:
2017-05-08 09:49:30 +08:00
/**
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
* @param dbaddr {const char*} <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><EFBFBD>ʽΪ<EFBFBD><EFBFBD>ip:port<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
* unix_domain_path<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ unix <EFBFBD><EFBFBD><EFBFBD>׽ӿ<EFBFBD>ʱ<EFBFBD><EFBFBD>ӦΪ unix <EFBFBD><EFBFBD><EFBFBD>׽ӿ<EFBFBD><EFBFBD>ļ<EFBFBD>
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ŀ¼<EFBFBD>Ҳ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> postgresql <EFBFBD><EFBFBD><EFBFBD>ڼ<EFBFBD><EFBFBD><EFBFBD> unix <EFBFBD><EFBFBD><EFBFBD>׽ӿ<EFBFBD>
* <EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>Ϊ<EFBFBD><EFBFBD>/tmp/.s.PGSQL.5432<EFBFBD><EFBFBD><EFBFBD><EFBFBD> dbaddr <EFBFBD><EFBFBD>ַӦ<EFBFBD><EFBFBD>Ϊ /tmp
* ע<EFBFBD>ע<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> unix <EFBFBD><EFBFBD><EFBFBD>׽ӿڵ<EFBFBD><EFBFBD><EFBFBD> mysql <EFBFBD>IJ<EFBFBD>ͬ<EFBFBD><EFBFBD>mysql <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>׽<EFBFBD>
* <EFBFBD><EFBFBD>Ϊȫ·<EFBFBD><EFBFBD>
* @param dbname {const char*} <EFBFBD><EFBFBD><EFBFBD>ݿ<EFBFBD><EFBFBD><EFBFBD>
2017-05-08 09:49:30 +08:00
*/
2017-04-27 21:46:28 +08:00
pgsql_conf(const char* dbaddr, const char* dbname);
2017-05-08 09:49:30 +08:00
/**
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
* @param conf {const pgsql_conf&} <EFBFBD>ڲ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ö<EFBFBD><EFBFBD>󲢿<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ò<EFBFBD><EFBFBD><EFBFBD>
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
2017-05-08 09:49:30 +08:00
*/
2017-04-27 21:46:28 +08:00
pgsql_conf(const pgsql_conf& conf);
2017-05-08 09:49:30 +08:00
2017-04-27 21:46:28 +08:00
~pgsql_conf(void);
2017-05-08 09:49:30 +08:00
/**
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݿ<EFBFBD>ʱ<EFBFBD><EFBFBD><EFBFBD>û<EFBFBD><EFBFBD>˺ţ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ô˷<EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˺<EFBFBD>
* @param dbuser {const char*} <EFBFBD>û<EFBFBD><EFBFBD>˺ţ<EFBFBD>Ϊ<EFBFBD>ǿ<EFBFBD><EFBFBD>ַ<EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ч
2017-05-08 09:49:30 +08:00
* @return {pgsql_conf&}
*/
2017-04-27 21:46:28 +08:00
pgsql_conf& set_dbuser(const char* dbuser);
2017-05-08 09:49:30 +08:00
/**
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݿ<EFBFBD>ʱ<EFBFBD><EFBFBD><EFBFBD>˺<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ô˷<EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
* @param dbpass {const char*} <EFBFBD>˺<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD>ǿ<EFBFBD><EFBFBD>ַ<EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ч
2017-05-08 09:49:30 +08:00
* @return {pgsql_conf&}
*/
2017-04-27 21:46:28 +08:00
pgsql_conf& set_dbpass(const char* dbpass);
2017-05-08 09:49:30 +08:00
/**
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݿ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ӳ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
* @param dblimit {size_t} <EFBFBD><EFBFBD><EFBFBD>ӳ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƣ<EFBFBD><EFBFBD><EFBFBD>Ϊ 0 ʱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
2017-05-08 09:49:30 +08:00
* @return {pgsql_conf&}
*/
2017-04-27 21:46:28 +08:00
pgsql_conf& set_dblimit(size_t dblimit);
2017-05-08 09:49:30 +08:00
/**
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݿ<EFBFBD><EFBFBD>ij<EFBFBD>ʱʱ<EFBFBD><EFBFBD>
2017-05-08 09:49:30 +08:00
* @param timeout {int}
* @return {pgsql_conf&}
*/
2017-04-27 21:46:28 +08:00
pgsql_conf& set_conn_timeout(int timeout);
2017-05-08 09:49:30 +08:00
/**
* <EFBFBD><EFBFBD><EFBFBD>ö<EFBFBD>ȡ<EFBFBD><EFBFBD><EFBFBD>ݿ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ij<EFBFBD>ʱʱ<EFBFBD><EFBFBD>
2017-05-08 09:49:30 +08:00
* @param int {timeout}
* @return {pgsql_conf&}
*/
2017-04-27 21:46:28 +08:00
pgsql_conf& set_rw_timeout(int timeout);
2017-05-08 09:49:30 +08:00
/**
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݿ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ӵ<EFBFBD><EFBFBD>ַ<EFBFBD><EFBFBD><EFBFBD>
2017-05-08 09:49:30 +08:00
* @param charset {const char*}
* @return {pgsql_conf&}
*/
2017-04-27 21:46:28 +08:00
pgsql_conf& set_charset(const char* charset);
const char* get_dbaddr() const
{
return dbaddr_;
}
const char* get_dbname() const
{
return dbname_;
}
const char* get_dbkey() const
{
return dbkey_;
}
const char* get_dbuser() const
{
return dbuser_;
}
const char* get_dbpass() const
{
return dbpass_;
}
2017-05-08 09:49:30 +08:00
size_t get_dblimit() const
{
return dblimit_;
}
2017-04-27 21:46:28 +08:00
int get_conn_timeout() const
{
return conn_timeout_;
}
int get_rw_timeout() const
{
return rw_timeout_;
}
const char* get_charset() const
{
return charset_;
}
private:
char* dbaddr_;
char* dbname_;
char* dbkey_;
char* dbuser_;
char* dbpass_;
char* charset_;
size_t dblimit_;
int conn_timeout_;
int rw_timeout_;
};
} // namespace acl