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

130 lines
2.7 KiB
C++
Raw Normal View History

2017-04-27 21:46:28 +08:00
#pragma once
#include "acl_cpp/acl_cpp_define.hpp"
namespace acl {
class ACL_CPP_API pgsql_conf
{
public:
2017-05-08 09:49:30 +08:00
/**
*
* @param dbaddr {const char*} ip:port
* unix_domain_path unix unix
* postgresql unix
* /tmp/.s.PGSQL.5432 dbaddr /tmp
* unix mysql mysql
*
* @param dbname {const char*}
*/
2017-04-27 21:46:28 +08:00
pgsql_conf(const char* dbaddr, const char* dbname);
2017-05-08 09:49:30 +08:00
/**
*
* @param conf {const pgsql_conf&}
*
*/
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
/**
*
* @param dbuser {const char*}
* @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
/**
*
* @param dbpass {const char*}
* @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
/**
*
* @param dblimit {size_t} 0
* @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
/**
*
* @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
/**
*
* @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
/**
*
* @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