How to return the error codes of the PostgreSQL server?

Forum related to version 6.5.1 (alpha) and 6.6.x (beta) of ZeosLib's DBOs

Moderators: gto, cipto_kh, EgonHugeist

Post Reply
smsanti
Fresh Boarder
Fresh Boarder
Posts: 11
Joined: 31.08.2005, 18:05
Location: Pelotas - RS - Brazil
Contact:

How to return the error codes of the PostgreSQL server?

Post 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?
User avatar
Lightning
Zeos Dev Team
Zeos Dev Team
Posts: 8
Joined: 29.08.2005, 11:29
Location: Romania

Post 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]
snorkel
Fresh Boarder
Fresh Boarder
Posts: 17
Joined: 01.09.2005, 18:55
Location: Milwaukee USA

Post 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]
smsanti
Fresh Boarder
Fresh Boarder
Posts: 11
Joined: 31.08.2005, 18:05
Location: Pelotas - RS - Brazil
Contact:

Post 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?
smsanti
Fresh Boarder
Fresh Boarder
Posts: 11
Joined: 31.08.2005, 18:05
Location: Pelotas - RS - Brazil
Contact:

Post 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.
User avatar
Lightning
Zeos Dev Team
Zeos Dev Team
Posts: 8
Joined: 29.08.2005, 11:29
Location: Romania

Post by Lightning »

I use Error detection with Firebird and i assumed it would work with MySQL and PostGres also.
tuxracer78
Fresh Boarder
Fresh Boarder
Posts: 7
Joined: 24.01.2008, 11:53

undeclared identifier EZSQLException

Post 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?
Post Reply