Problem
psqlodbc, with libpq enabled, will do exit(1), if connecting into the
database fails.
A good fix seems to be to remove the exit_nicely() function call.
----------------------
static void
exit_nicely(PGconn *conn)
{
PQfinish(conn);
exit(1);
}
----------------------
Connect code:
self->pgconn = PQconnectdb(conninfo);
if (PQstatus(self->pgconn) != CONNECTION_OK)
{
CC_set_error(self,CONNECTION_COULD_NOT_ESTABLISH,PQerrorMessage(self->pgconn));
mylog("could not establish connection to the database %s
\n",PQerrorMessage(self->pgconn));
exit_nicely(self->pgconn);
free(conninfo);
return 0;
}
------------------------
Marko Ristola