Recent

Author Topic: Firebird - Lazarus catch EDatabaseError not EIBSDatabaseError  (Read 4179 times)

Lesle

  • New member
  • *
  • Posts: 5
Firebird - Lazarus catch EDatabaseError not EIBSDatabaseError
« 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?
Greetings Leszek

BigChimp

  • Hero Member
  • *****
  • Posts: 5740
  • Add to the wiki - it's free ;)
    • FPCUp, PaperTiger scanning and other open source projects
Re: Firebird - Lazarus catch EDatabaseError not EIBSDatabaseError
« Reply #1 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

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...
Want quicker answers to your questions? Read http://wiki.lazarus.freepascal.org/Lazarus_Faq#What_is_the_correct_way_to_ask_questions_in_the_forum.3F

Open source including papertiger OCR/PDF scanning:
https://bitbucket.org/reiniero

Lazarus trunk+FPC trunk x86, Windows x64 unless otherwise specified

Lesle

  • New member
  • *
  • Posts: 5
Re: Firebird - Lazarus catch EDatabaseError not EIBSDatabaseError
« Reply #2 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?
Greetings Leszek

BigChimp

  • Hero Member
  • *****
  • Posts: 5740
  • Add to the wiki - it's free ;)
    • FPCUp, PaperTiger scanning and other open source projects
Re: Firebird - Lazarus catch EDatabaseError not EIBSDatabaseError
« Reply #3 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?
Want quicker answers to your questions? Read http://wiki.lazarus.freepascal.org/Lazarus_Faq#What_is_the_correct_way_to_ask_questions_in_the_forum.3F

Open source including papertiger OCR/PDF scanning:
https://bitbucket.org/reiniero

Lazarus trunk+FPC trunk x86, Windows x64 unless otherwise specified

Lacak2

  • Guest
Re: Firebird - Lazarus catch EDatabaseError not EIBSDatabaseError
« Reply #4 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

Lesle

  • New member
  • *
  • Posts: 5
Re: Firebird - Lazarus catch EDatabaseError not EIBSDatabaseError
« Reply #5 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?
Greetings Leszek

Lacak2

  • Guest
Re: Firebird - Lazarus catch EDatabaseError not EIBSDatabaseError
« Reply #6 on: November 24, 2011, 01:20:28 pm »
Is there any error code of EDatabaseError like in EIBDatabaseError?
AFAIK no