Re: libpq ::PQstatus() - Mailing list pgsql-general

From Einar Karttunen
Subject Re: libpq ::PQstatus()
Date
Msg-id 20010820212255.B10587@cs.helsinki.fi
Whole thread Raw
In response to libpq ::PQstatus()  ("Zuev Dmitry" <envoy1@chat.ru>)
List pgsql-general
On Wed, Aug 15, 2001 at 06:37:53PM +0600, Zuev Dmitry wrote:
> can anybody tell me why PQstatus() return not realy status ?
> i make a connection, then PQstatus() tell ok
> i stop database and PQstatus() tell me ok again (((
> is where method for get real status of connection ?
>
PQstatus checks whether the last thing returned by db was ok,
not whether the db is still alive. I suggest using some
dummy query like:
PQexec('SELECT 1;');

- Einar Karttunen

pgsql-general by date:

Previous
From: Gordan Bobic
Date:
Subject: Re: nextval, sequences and sequencenames
Next
From: Corey Minter
Date:
Subject: database corruption on VACUUM ANALYZE, now unable to initdb