Allow omitting username and dbname in connection string.
This commit is contained in:
parent
5daa49ff41
commit
6dc3015ea5
1 changed files with 3 additions and 3 deletions
|
@ -48,9 +48,9 @@ class Connection
|
|||
std::string connStr;
|
||||
if (host.length()) connStr += "host="+host;
|
||||
if (port.length()) connStr += " port="+port;
|
||||
connStr+=" dbname="+dbname;
|
||||
connStr+=" user="+username;
|
||||
connStr+=" password="+password;
|
||||
if (dbname.length()) connStr+=" dbname="+dbname;
|
||||
if (username.length()) connStr+=" user="+username;
|
||||
if (password.length()) connStr+=" password="+password;
|
||||
connStr+=" connect_timeout=4"; // todo: set by client (param)
|
||||
|
||||
conn_=PQconnectdb(connStr.c_str());
|
||||
|
|
Loading…
Add table
Reference in a new issue