Added connect_timeout parameter to postgis connection (set to 4 sec).

This commit is contained in:
Artem Pavlenko 2006-12-22 11:57:02 +00:00
parent 37ebe481c9
commit 6aa5401151

View file

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