2018-12-12 11:16:12 +08:00
|
|
|
|
#pragma once
|
|
|
|
|
#include "../acl_cpp_define.hpp"
|
|
|
|
|
|
|
|
|
|
namespace acl {
|
|
|
|
|
|
|
|
|
|
class ACL_CPP_API pgsql_conf
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
/**
|
|
|
|
|
* <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>
|
|
|
|
|
*/
|
|
|
|
|
pgsql_conf(const char* dbaddr, const char* dbname);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* <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>
|
|
|
|
|
*/
|
|
|
|
|
pgsql_conf(const pgsql_conf& conf);
|
|
|
|
|
|
|
|
|
|
~pgsql_conf(void);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* <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>Ч
|
|
|
|
|
* @return {pgsql_conf&}
|
|
|
|
|
*/
|
|
|
|
|
pgsql_conf& set_dbuser(const char* dbuser);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* <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>Ч
|
|
|
|
|
* @return {pgsql_conf&}
|
|
|
|
|
*/
|
|
|
|
|
pgsql_conf& set_dbpass(const char* dbpass);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* <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>
|
|
|
|
|
* @return {pgsql_conf&}
|
|
|
|
|
*/
|
|
|
|
|
pgsql_conf& set_dblimit(size_t dblimit);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݿ<EFBFBD><EFBFBD>ij<EFBFBD>ʱʱ<EFBFBD><EFBFBD>
|
|
|
|
|
* @param timeout {int}
|
|
|
|
|
* @return {pgsql_conf&}
|
|
|
|
|
*/
|
|
|
|
|
pgsql_conf& set_conn_timeout(int timeout);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD>ö<EFBFBD>ȡ<EFBFBD><EFBFBD><EFBFBD>ݿ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ij<EFBFBD>ʱʱ<EFBFBD><EFBFBD>
|
|
|
|
|
* @param int {timeout}
|
|
|
|
|
* @return {pgsql_conf&}
|
|
|
|
|
*/
|
|
|
|
|
pgsql_conf& set_rw_timeout(int timeout);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݿ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ӵ<EFBFBD><EFBFBD>ַ<EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @param charset {const char*}
|
|
|
|
|
* @return {pgsql_conf&}
|
|
|
|
|
*/
|
|
|
|
|
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_;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
size_t get_dblimit() const
|
|
|
|
|
{
|
|
|
|
|
return dblimit_;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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
|