psqlodbc libpq version: quiet error on connect failure - Mailing list pgsql-odbc

From Marko Ristola
Subject psqlodbc libpq version: quiet error on connect failure
Date
Msg-id 42DE3427.5040607@kolumbus.fi
Whole thread Raw
List pgsql-odbc
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


pgsql-odbc by date:

Previous
From: "Anoop Kumar"
Date:
Subject: Re: Leak repairs
Next
From: Marko Ristola
Date:
Subject: A correction into the connect exit(1) problem