EZDatabaseError error codes.

In this forum we will discuss things relating the ZEOSLib 6.6.x stable versions

Moderators: gto, EgonHugeist

Post Reply
jjeffman
Senior Boarder
Senior Boarder
Posts: 56
Joined: 25.08.2005, 12:40
Location: Porto Alegre

EZDatabaseError error codes.

Post by jjeffman »

Hello,

I would like to use the EZDatabaseError::ErrorCode property to implement different application messages according to the returned value of it. May I presume that the ErrorCode property assumes the value raised by database client software ?

Is there any list of values which can be used as a reference for ErrorCode ?

The code below I have copied from the file ZAbstractRODataset.pas :

Code: Select all

  
  {** Implements a Zeos specific database exception with SQL error code. }
  EZDatabaseError = class(EDatabaseError)
  private
    FErrorCode: Integer;
    FStatusCode: String;
    procedure SetStatusCode(const Value: String);
   public
    constructor Create(const Msg: string);
    constructor CreateFromException(E: EZSQLThrowable);

    property ErrorCode: Integer read FErrorCode write FErrorCode;
    property StatusCode: String read FStatusCode write SetStatusCode;
  end;
The class EDatabaseError from which EZDatabaseError derives has no the ErrorCode property.

Thank you very much.
Jayme Jeffman Filho

DBA, Software Engineer
Sul Engenharia e Sistema Ltda

http://www.sulenge.com.br
marsupilami
Platinum Boarder
Platinum Boarder
Posts: 1918
Joined: 17.01.2011, 14:17

Re: EZDatabaseError error codes.

Post by marsupilami »

Hello Jayme,

I think that depends very much on the DBC database driver that is in use. Maybe you should have a look at the source on how the driver that you use works.
With best regards,

Jan
jjeffman
Senior Boarder
Senior Boarder
Posts: 56
Joined: 25.08.2005, 12:40
Location: Porto Alegre

Re: EZDatabaseError error codes.

Post by jjeffman »

Thank you marsupilami,
marsupilami wrote:Hello Jayme,

I think that depends very much on the DBC database driver that is in use. Maybe you should have a look at the source on how the driver that you use works.
With best regards,

Jan
I am using a mysql database and the "mysql" protocol, so what is the ErrorCode for "Parent key not found" or "Duplicate entry" ?

Thank you very much.

Kind regards
Jayme Jeffman Filho

DBA, Software Engineer
Sul Engenharia e Sistema Ltda

http://www.sulenge.com.br
marsupilami
Platinum Boarder
Platinum Boarder
Posts: 1918
Joined: 17.01.2011, 14:17

Re: EZDatabaseError error codes.

Post by marsupilami »

Hello Jayme,

honestly, I don't know the error codes. I can only suggest to you again to have a look into the source code of the MySQL DBC layer driver.
With best regards,

Jan
jjeffman
Senior Boarder
Senior Boarder
Posts: 56
Joined: 25.08.2005, 12:40
Location: Porto Alegre

Re: EZDatabaseError error codes.

Post by jjeffman »

Hello Marsupilami,

Unfortunately the ErrorCode which is being attached during the Exception creation has nothing to do with the mysql error, so in fact I would need a list of EZDatabaseError ErrorCode values and meaning to take decisions inside the try-catch block.

As I am interested only in some of them I have provoked the database errors and saved some EZDatabaseError error codes. So this thread can be marked as solved.

Best regards.
Jayme Jeffman Filho

DBA, Software Engineer
Sul Engenharia e Sistema Ltda

http://www.sulenge.com.br
Post Reply