|
|
 | | From: | X X | | Subject: | libpq: how to get error code (not message) | | Date: | Wed, 1 Dec 2004 19:11:44 -0800 (PST) |
|
|
 | Hello,
I'm writing a client in C++ using the C-library (libpq) interface to PostgreSQL server.
I would like to know what function to call to obtain one of the codes listed at
http://www.postgresql.org/docs/7.4/static/errcodes-appendix.html
(I'm aware from other postings that in JDBC it would be a getSQLState() call, but what if I have to code the client in C/C++ and use libpq ?)
I found that the error codes are defined in file errcodes.h under the /server include directory, but can't find the client-side function that returns them.
Any hints are much appreciated, Serge
__________________________________ Do you Yahoo!? Yahoo! Mail - Helps protect you from nasty viruses. http://promotions.yahoo.com/new_mail
---------------------------(end of broadcast)--------------------------- TIP 6: Have you searched our list archives?
http://archives.postgresql.org
|
|
 | | From: | Michael Fuhr | | Subject: | Re: libpq: how to get error code (not message) | | Date: | Wed, 1 Dec 2004 23:06:48 -0700 |
|
|
 | On Wed, Dec 01, 2004 at 07:11:44PM -0800, X X wrote:
> I would like to know what function to call to obtain > one of the codes listed at > > http://www.postgresql.org/docs/7.4/static/errcodes-appendix.html
I think you're looking for PQresultErrorField() called with the fieldcode argument set to PG_DIAG_SQLSTATE.
-- Michael Fuhr http://www.fuhr.org/~mfuhr/
---------------------------(end of broadcast)--------------------------- TIP 5: Have you checked our extensive FAQ?
http://www.postgresql.org/docs/faqs/FAQ.html
|
|
|