UNIVERS  15.3
UNIVERS base processing software API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
dbcontext_qsql.hpp
1 /* dbcontext_qsql.hpp */
2 /* $Id$ */
3 #ifndef __dbcontext_qsql_hpp
4 #define __dbcontext_qsql_hpp
5 
6 #include <string>
7 
9 namespace hds
10 {
12  namespace db
13  {
16  {
17  public:
18 
25  ContextQSql();
26 
33  ContextQSql(const std::string &host,
34  const std::string &db_name,
35  const std::string &user,
36  const std::string &passwd);
37 
45  static ContextQSql fromEnv(const std::string host_env = "HDS_DB_HOST",
46  const std::string db_name_env = "HDS_DB_NAME",
47  const std::string user_env = "HDS_DB_USER",
48  const std::string passwd_env = "HDS_DB_PASSWD");
49 
50 
52  void setHost(const std::string &host);
53 
55  void setDbName(const std::string &db_name);
56 
58  void setUser(const std::string &user);
59 
61  void setPasswd(const std::string &passwd);
62 
64  const std::string& host() const;
65 
67  const std::string& dbName() const;
68 
70  const std::string& user() const;
71 
73  const std::string& passwd() const;
74 
75  protected:
76 
77  std::string m_host;
78  std::string m_db_name;
79  std::string m_user;
80  std::string m_passwd;
81  };
82  }; // db
83 }; // hds
84 
85 #endif /* dbcontext_qsql.hpp */
void setUser(const std::string &user)
const std::string & passwd() const
Definition: dbcontext_qsql.hpp:15
void setPasswd(const std::string &passwd)
std::string m_host
Definition: dbcontext_qsql.hpp:77
const std::string & host() const
void setDbName(const std::string &db_name)
const std::string & user() const
std::string m_user
Definition: dbcontext_qsql.hpp:79
const std::string & dbName() const
std::string m_db_name
Definition: dbcontext_qsql.hpp:78
void setHost(const std::string &host)
static ContextQSql fromEnv(const std::string host_env="HDS_DB_HOST", const std::string db_name_env="HDS_DB_NAME", const std::string user_env="HDS_DB_USER", const std::string passwd_env="HDS_DB_PASSWD")
std::string m_passwd
Definition: dbcontext_qsql.hpp:80