Lazarus

Programming => Databases => Topic started by: Lesle on November 23, 2011, 11:15:35 pm

Title: Firebird - Lazarus catch EDatabaseError not EIBSDatabaseError
Post by: Lesle on November 23, 2011, 11:15:35 pm
I have installed lazarus-0.9.30-fpc-2.4.2-win32 and Firebird 2.5.1 on Windows 7 64bit
I build simple Form with IBConnection , ... , SQLQuery.
On Form I have DBEdit Fields connected via SQLQuery to one of my table in Firebird.
When I try insert/update data and not fill all required fields I receive exception but not EIBDatabaseError but  EDatabaseError . This means I have only message, no Firebird error code
I would like to translate message but when I dont have Firebird error code I don't have possibility to do it simple.

Any idea why I dont receive EIBDatabaseError but EDatabaseError?
Title: Re: Firebird - Lazarus catch EDatabaseError not EIBSDatabaseError
Post by: BigChimp on November 23, 2011, 11:21:24 pm
Nope, I remember FPC 64 bit incorrectly catches errors that the Firebird database client code should handle: http://bugs.freepascal.org/view.php?id=17360 (http://bugs.freepascal.org/view.php?id=17360)

On 32 bit FPC, it works, according to that bug report...

Apart from that, I don't know of any problems with Firebird error codes...
Title: Re: Firebird - Lazarus catch EDatabaseError not EIBSDatabaseError
Post by: Lesle on November 23, 2011, 11:25:55 pm
I had run compiled on Win7 64 bit Lazarus program on win32 but result was the same.
You think it could be it was compiled on win 64bit?
Title: Re: Firebird - Lazarus catch EDatabaseError not EIBSDatabaseError
Post by: BigChimp on November 24, 2011, 05:50:47 am
If the program ran unchanged on Win32 it must have been compiled for 32 bit - Win64 can run 64 and 32 bit executables; Win32 can run 32 bit (and 16, IIRC  :D )...

I was thinking about the order that you handle exceptions (first the Firebird, then general db or the other way round) and it seems that makes a difference.
I'm assuming you're testing for the Firebird error first?

Perhaps show a code snippet?
Title: Re: Firebird - Lazarus catch EDatabaseError not EIBSDatabaseError
Post by: Lacak2 on November 24, 2011, 08:11:19 am
When I try insert/update data and not fill all required fields I receive exception but not EIBDatabaseError but  EDatabaseError .
...
Any idea why I dont receive EIBDatabaseError but EDatabaseError?
Because Required fields are checked at TDataSet level in procedure TDataSet.InternalPost;
(at client - FPC side ... so error is not returned by server ... so no IB error code there)
And this is TSQLConnector independent code, so there is raised generic EDatabaseError
Title: Re: Firebird - Lazarus catch EDatabaseError not EIBSDatabaseError
Post by: Lesle on November 24, 2011, 09:55:33 am
Lacak2 you have right. I get to that yesterday night ;). If I made SqlQuery.Prepare then I received EIBDatabaseError but doing only SqlQuery.ApplyUpdates I receive EDatabaseError.

Knowing that, any sugestion how to check what EDatabaseError is throw to translate it into other language?
Is there any error code of EDatabaseError like in EIBDatabaseError?
Title: Re: Firebird - Lazarus catch EDatabaseError not EIBSDatabaseError
Post by: Lacak2 on November 24, 2011, 01:20:28 pm
Is there any error code of EDatabaseError like in EIBDatabaseError?
AFAIK no
TinyPortal © 2005-2018