libpq ::PQstatus()

Started by Zuev Dmitryover 24 years ago2 messagesgeneral
Jump to latest
#1Zuev Dmitry
envoy1@chat.ru

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 ?

wbr, Dmitry

#2Einar Karttunen
ekarttun@cs.Helsinki.FI
In reply to: Zuev Dmitry (#1)
Re: libpq ::PQstatus()

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