UNIVERS  15.3
UNIVERS base processing software API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Public Member Functions | Static Public Member Functions | Protected Attributes | List of all members
hds::db::ContextQSql Class Reference

#include <dbcontext_qsql.hpp>

Public Member Functions

 ContextQSql ()
 
 ContextQSql (const std::string &host, const std::string &db_name, const std::string &user, const std::string &passwd)
 
void setHost (const std::string &host)
 
void setDbName (const std::string &db_name)
 
void setUser (const std::string &user)
 
void setPasswd (const std::string &passwd)
 
const std::string & host () const
 
const std::string & dbName () const
 
const std::string & user () const
 
const std::string & passwd () const
 

Static Public Member Functions

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")
 

Protected Attributes

std::string m_host
 
std::string m_db_name
 
std::string m_user
 
std::string m_passwd
 

Detailed Description

Database connection context

Constructor & Destructor Documentation

hds::db::ContextQSql::ContextQSql ( )
Default context. 

host = "localhost" db_name = "hds" user = "root" passwd = <empty>

hds::db::ContextQSql::ContextQSql ( const std::string &  host,
const std::string &  db_name,
const std::string &  user,
const std::string &  passwd 
)
Constructor with context data provided. 
Parameters
hostHost name.
db_nameDatabase name.
userDatabase user name.
passwdDatabase user password.

Member Function Documentation

const std::string& hds::db::ContextQSql::dbName ( ) const

Current data base name.

static ContextQSql hds::db::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" 
)
static
Return database context constructed from system enviroment.

Default context value assumed if any system variable not defined. Name of database host name system variable. Name of database system variable. Database user system variable. Database user password system variable.

Returns
database condext.
const std::string& hds::db::ContextQSql::host ( ) const

Current host.

const std::string& hds::db::ContextQSql::passwd ( ) const

Current password.

void hds::db::ContextQSql::setDbName ( const std::string &  db_name)

Set data base name.

void hds::db::ContextQSql::setHost ( const std::string &  host)

Set host name.

void hds::db::ContextQSql::setPasswd ( const std::string &  passwd)

Set password.

void hds::db::ContextQSql::setUser ( const std::string &  user)

Set user name.

const std::string& hds::db::ContextQSql::user ( ) const

Current user.

Member Data Documentation

std::string hds::db::ContextQSql::m_db_name
protected

Data base name.

std::string hds::db::ContextQSql::m_host
protected

Host name.

std::string hds::db::ContextQSql::m_passwd
protected

Password.

std::string hds::db::ContextQSql::m_user
protected

User name.


The documentation for this class was generated from the following file: