About management error on IBCTransaction

Discussion of open issues, suggestions and bugs regarding IBDAC (InterBase Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
dehorter
Posts: 45
Joined: Fri 16 Oct 2009 13:53

About management error on IBCTransaction

Post by dehorter » Tue 28 Jun 2016 10:33

Hi

In order to learn how to intercept exception on IBCTransaction, I prepare a code like this

Code: Select all

try
           IF NOT TransactionFB.Active THEN
              TransactionFB.StartTransaction;
        TransactionFB.StartTransaction;  // just to create an exception

except
   on E: Exception do
   begin
      if E is EDatabaseError then
      Begin
            IF Log THEN
                ShowMessage( E.Message);
      End else begin
             IF Log THEN
                ShowMessage(E.ClassName + ' with message:' + E.Message);
      end;
   end;
end;
The event OnError from IBCTransaction component doesn't intercept the execution on course ("Occurs when processing errors that are raised during executing transaction and savepoint control statements such as COMMIT, ROLLBACK, SAVEPOINT, RELEASE SAVEPOINT and others. ") as well as the OnError event from the IBCConnection...

Anyway, according to your guide, this kind of error should be generate an EDatabaseError exception ("If TDATransaction.Active is True, indicating that a transaction is already in progress, a subsequent call to StartTransaction will raise EDatabaseError.").
However It is not the case with my exemple : the ClasseName is "Exception"

is it normal ?

ViktorV
Devart Team
Posts: 3168
Joined: Wed 30 Jul 2014 07:16

Re: About management error on IBCTransaction

Post by ViktorV » Thu 30 Jun 2016 08:49

TIBCConnectin.OnError and TIBCTransaction.OnError is applied to error handling only, that are returned by the InterBase/Firebird. Not InterBase/Firebird returns the provided error, it is generated in our code. Therefore the TIBCConnectin.OnError and TIBCTransaction.OnError events are not triggered. And the exception class in this case is Exception indeed, not EDatabaseError.

dehorter
Posts: 45
Joined: Fri 16 Oct 2009 13:53

Re: About management error on IBCTransaction

Post by dehorter » Thu 30 Jun 2016 09:01

Thanks for your quick reply

That's means that the sentence from yours supports is wrong
""If TDATransaction.Active is True, indicating that a transaction is already in progress, a subsequent call to StartTransaction will raise EDatabaseError." :lol:

regeards
olivier

ViktorV
Devart Team
Posts: 3168
Joined: Wed 30 Jul 2014 07:16

Re: About management error on IBCTransaction

Post by ViktorV » Thu 30 Jun 2016 10:40

Thank you for being interested in our products. We will consider your comments and edit the IBDAC help.

Post Reply