[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [tpop3d-discuss]Database connection
From: |
Daniel Tiefnig |
Subject: |
Re: [tpop3d-discuss]Database connection |
Date: |
Wed, 30 Nov 2005 11:36:09 +0100 |
User-agent: |
Debian Thunderbird 1.0.7 (X11/20051010) |
address@hidden wrote:
> Would it be hard to add kindda ping to see if connection is alive et
> reconnect to it in case not?
Sure not.
> Where should I look to add such a beast?
auth_pgsql.c would be the place to implement this. There are three calls
to PQexec in this file. (one in each of auth_pgsql_new_apop,
auth_pgsql_new_user_pass and auth_pgsql_onlogin) You could call
PQstatus() after a query failed, followed by PQreset() if status is not
"CONNECTION_OK". After that you may want to retry your query, so this
could be put into a loop, but take care to don't loop forever. Kind of 3
retries should be sufficient, with a little sleep between them.
Maybe it would be the best to put the calls to PQexec() inside a
function (like "do_PQexec" or something) so this hasn't to be
implemented three times.
If you need help to implement this, feel free to ask. I don't have much
spare time at the moment, but I'll do what I can.
The pgsql C API is explained at
http://www.postgresql.org/docs/7.4/interactive/libpq.html
It has lots of usefull information and also some sample programs.
lg,
daniel
- [tpop3d-discuss]Database connection, ohp, 2005/11/30
- Re: [tpop3d-discuss]Database connection,
Daniel Tiefnig <=
- Re: [tpop3d-discuss]Database connection, ohp, 2005/11/30
- Re: [tpop3d-discuss]Database connection, Daniel Tiefnig, 2005/11/30
- Re: [tpop3d-discuss]Database connection, ohp, 2005/11/30
- Re: [tpop3d-discuss]Database connection, Daniel Tiefnig, 2005/11/30
- Re: [tpop3d-discuss]Database connection, ohp, 2005/11/30
- Re: [tpop3d-discuss]Database connection, Daniel Tiefnig, 2005/11/30
- Re: [tpop3d-discuss]Database connection, ohp, 2005/11/30