Thread: PQconnectdb et.all.
How can I programatically figure out why PQconnectdb failed? The reason for this is that my daemon needs to know:1- if to try and reconnect (for example, if it's timing out) 2- abandom,if for example it has not permition. thanks,danny
on 4/4/06 8:09 AM, danny@cs.huji.ac.il purportedly said: > How can I programatically figure out why PQconnectdb failed? > The reason for this is that my daemon needs to know: > 1- if to try and reconnect (for example, if it's timing out) > 2- abandom, if for example it has not permition. If your question is whether you can reliably parse the result of PQerrorMessage and determine a course of action, I think the answer is "kind of." My understanding is that these error messages are just a human-friendly indicator and are subject to change. You might be able to check "errno", but I can't say whether that will be informative (depends on what libpq does in its depths, scoping issues, among other things). That being said, you could try to catalog the common messages and behave accordingly, but with the caveat that future versions may change the messages. Hope this helps, Keary Suska Esoteritech, Inc. "Demystifying technology for your home or business"
--- Danny Braniss <danny@cs.huji.ac.il> wrote: > How can I programatically figure out why PQconnectdb failed? PQstatus() Regards, Andy ___________________________________________________________ Win a BlackBerry device from O2 with Yahoo!. Enter now. http://www.yahoo.co.uk/blackberry
Danny Braniss wrote: > How can I programatically figure out why PQconnectdb failed? > The reason for this is that my daemon needs to know: > 1- if to try and reconnect (for example, if it's timing out) > 2- abandom, if for example it has not permition. > thanks, > danny > > > > ---------------------------(end of broadcast)--------------------------- > TIP 6: explain analyze is your friend > > Just determine the SQLState from the last operation and use this table http://www.postgresql.org/docs/8.1/static/errcodes-appendix.html Regards, gamehack