For Programmers: Free Programming Magazines  


Home > Archive > PHP DB > September 2004 > Detailed db error codes









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Detailed db error codes
Tumurbaatar S.

2004-09-27, 8:55 am

I work with PHP5 and PostgreSQL7.4
Currently (for testing purpose) my script catches
the db errors and echoes them to a client without
any manipulation. But I need to examine these errors
and echo messages according the error type/class.
From the PostgreSQL doc:

....All messages emitted by the PostgreSQL server are assigned five-character
error codes that follow the SQL standard's conventions for "SQLSTATE" codes.
Applications that need to know which error condition has occurred should
usually test the error code, rather than looking at the textual error
message. The error codes are less likely to change across PostgreSQL
releases, and also are not subject to change due to localization of error
messages...

Anybody know how to get the PostgreSQL error code/class in PHP?
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com