pg.ddx.io  pgsql-odbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Marko Ristola <Marko.Ristola@kolumbus.fi>
To: pgsql-odbc@postgresql.org
Subject: psqlodbc libpq version: quiet error on connect failure
Date: Wed, 20 Jul 2005 14:23:19 +0300
Message-ID: <42DE3427.5040607@kolumbus.fi> (raw)


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




view thread (4+ messages)  latest in thread

Message-ID: <42DE3427.5040607@kolumbus.fi>
Permalink:  ../42DE3427.5040607@kolumbus.fi/
Also on:    postgresql.org/message-id/42DE3427.5040607@kolumbus.fi

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-odbc@postgresql.org
  Cc: Marko.Ristola@kolumbus.fi
  Subject: Re: psqlodbc libpq version: quiet error on connect failure
  In-Reply-To: <42DE3427.5040607@kolumbus.fi>
  References: <42DE3427.5040607@kolumbus.fi>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox