Allow omitting username and dbname in connection string.

This commit is contained in:
Artem Pavlenko 2007-04-01 08:29:14 +00:00
parent 5daa49ff41
commit 6dc3015ea5

View file

@ -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());