Added connect_timeout parameter to postgis connection (set to 4 sec).
This commit is contained in:
parent
37ebe481c9
commit
6aa5401151
1 changed files with 2 additions and 0 deletions
|
@ -52,6 +52,7 @@ public:
|
||||||
connStr+=" dbname="+dbname;
|
connStr+=" dbname="+dbname;
|
||||||
connStr+=" user="+username;
|
connStr+=" user="+username;
|
||||||
connStr+=" password="+password;
|
connStr+=" password="+password;
|
||||||
|
connStr+=" connect_timeout=4"; // todo: set by client (param)
|
||||||
|
|
||||||
conn_=PQconnectdb(connStr.c_str());
|
conn_=PQconnectdb(connStr.c_str());
|
||||||
if (PQstatus(conn_) == CONNECTION_BAD)
|
if (PQstatus(conn_) == CONNECTION_BAD)
|
||||||
|
@ -60,6 +61,7 @@ public:
|
||||||
<< PQerrorMessage(conn_)<< std::endl;
|
<< PQerrorMessage(conn_)<< std::endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool execute(const std::string& sql) const
|
bool execute(const std::string& sql) const
|
||||||
{
|
{
|
||||||
PGresult *result=PQexec(conn_,sql.c_str());
|
PGresult *result=PQexec(conn_,sql.c_str());
|
||||||
|
|
Loading…
Reference in a new issue