pg.ddx.io  pgsql-interfaces@postgresql.org mailing list archive  
help / color / mirror / Atom feed
PQconnectdb et.all.
4+ messages / 4 participants
[nested] [flat]

* PQconnectdb et.all.
@ 2006-04-04 15:09  Danny Braniss <danny@cs.huji.ac.il>
  0 siblings, 3 replies; 4+ messages in thread

From: Danny Braniss @ 2006-04-04 15:09 UTC (permalink / raw)
  To: pgsql-interfaces

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





^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: PQconnectdb et.all.
@ 2006-04-04 20:41  Keary Suska <hierophant@pcisys.net>
  parent: Danny Braniss <danny@cs.huji.ac.il>
  2 siblings, 0 replies; 4+ messages in thread

From: Keary Suska @ 2006-04-04 20:41 UTC (permalink / raw)
  To: pgsql-interfaces

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"




^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: PQconnectdb et.all.
@ 2006-04-05 11:34  Andy Chambers <andychambers2002@yahoo.co.uk>
  parent: Danny Braniss <danny@cs.huji.ac.il>
  2 siblings, 0 replies; 4+ messages in thread

From: Andy Chambers @ 2006-04-05 11:34 UTC (permalink / raw)
  To: pgsql-interfaces


--- 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



^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: PQconnectdb et.all.
@ 2006-04-05 14:29  Milen Dzhumerov <gamehack@1nsp1r3d.co.uk>
  parent: Danny Braniss <danny@cs.huji.ac.il>
  2 siblings, 0 replies; 4+ messages in thread

From: Milen Dzhumerov @ 2006-04-05 14:29 UTC (permalink / raw)
  To: pgsql-interfaces

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



^ permalink  raw  reply  [nested|flat] 4+ messages in thread


end of thread, other threads:[~2006-04-05 14:29 UTC | newest]

Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2006-04-04 15:09 PQconnectdb et.all. Danny Braniss <danny@cs.huji.ac.il>
2006-04-04 20:41 ` Keary Suska <hierophant@pcisys.net>
2006-04-05 11:34 ` Andy Chambers <andychambers2002@yahoo.co.uk>
2006-04-05 14:29 ` Milen Dzhumerov <gamehack@1nsp1r3d.co.uk>

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