File tree Expand file tree Collapse file tree 2 files changed +8
-3
lines changed
Expand file tree Collapse file tree 2 files changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -98,7 +98,9 @@ void PostgresDriver::openPrivate( const DriverParametersMap &conn )
9898
9999 if ( PQstatus ( c ) != CONNECTION_OK )
100100 {
101- throw GeoDiffException ( " Cannot connect to PostgreSQL database: " + std::string ( PQerrorMessage ( c ) ) );
101+ std::string msg ( PQerrorMessage ( c ) );
102+ PQfinish ( c );
103+ throw GeoDiffException ( " Cannot connect to PostgreSQL database: " + msg );
102104 }
103105
104106 mConn = c;
Original file line number Diff line number Diff line change @@ -24,8 +24,11 @@ extern "C"
2424void execSqlCommandsFromString ( const std::string &conninfo, const std::string &sql )
2525{
2626 PGconn *c = PQconnectdb ( conninfo.c_str () );
27-
28- ASSERT_EQ ( PQstatus ( c ), CONNECTION_OK );
27+ if ( PQstatus ( c ) != CONNECTION_OK )
28+ {
29+ PQfinish ( c );
30+ FAIL () << " Failed to connect to Postgres!" ;
31+ }
2932
3033 PGresult *res = PQexec ( c, sql.c_str () );
3134 ASSERT_TRUE ( res );
You can’t perform that action at this time.
0 commit comments