Page 1 of 1

How to return the error codes of the PostgreSQL server?

Posted: 01.09.2005, 22:15
by smsanti
In an application Delphi 7 + ZeosLib 6.5.1 Alpha + PostgreSQL 8.0.3.

How can I do to get the error codes returned by the postgresql server?

Posted: 02.09.2005, 07:54
by Lightning
This should work with all protocols:

[php]try
somecode ..
except
on E: EZSQLException do
begin
E.ErrorCode // Do something with ErrorCode
E.MEssage // Do something with Message
end;
end;[/php]

Posted: 02.09.2005, 19:08
by snorkel
Note, this won't catch RAISE NOTICE statements from a function.
Lightning wrote:This should work with all protocols:

[php]try
somecode ..
except
on E: EZSQLException do
begin
E.ErrorCode // Do something with ErrorCode
E.MEssage // Do something with Message
end;
end;[/php]

Posted: 05.09.2005, 13:38
by smsanti
The properties of E are: Message and HelpContext just. I think that PostgreSQL don't return the ErrorCode, but Error message.

And Zeos don't work with error codes. If I see rigth Zeos returns only the messages for all protocols. Am I wrong?

Posted: 05.09.2005, 18:32
by smsanti
Actually PostgreSQL don't return a error code, but Zeos doesn't negotiate or returns this code. I believe that Zeos behaves in the same way with the other protocols. I was analyzing with a collaborator that altered the code source of Zeos to increase the property E.ErrorCode.

I suggested that he makes himself registration in this forum and he verified as sending these updates for they be liberated in a next version.

Posted: 05.09.2005, 22:16
by Lightning
I use Error detection with Firebird and i assumed it would work with MySQL and PostGres also.

undeclared identifier EZSQLException

Posted: 24.01.2008, 12:11
by tuxracer78
Hello,

I get an error message "undeclared identifier EZSQLException" with ZDBO 6.6.1 - beta and Postgresql 8.1 while trying to use "on E: EZSQLException do".
Do i need to include anything before, e.g. a unit?