Firebird - conflicts detection

Discussion of open issues, suggestions and bugs regarding UniDAC (Universal Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
testpresta
Posts: 32
Joined: Sat 07 Jun 2014 19:41

Firebird - conflicts detection

Post by testpresta » Tue 05 Aug 2014 19:40

Hello

When i user try to post updates on a TUniTable component, i get this exception:

"Refresh failed. Found 0 records"

This is because another user does an update on the same record at the same time.

I want to detect this conflicts and display my own error message.

I have done something like that:

Code: Select all

try
  ...
  MyUniTable.post;
except
 on foo: Exception do begin
     if foo.Message="Refresh failed. Found 0 records" then 
     begin
       <here is my custom message>
     end;
 end;
Do you think devart will change the ""Refresh failed. Found 0 records" message in the future ?

Is there another way to detect this situation (Exception type ? Error number ?))

Thanks

PavloP
Devart Team
Posts: 149
Joined: Fri 24 Jan 2014 12:33

Re: Firebird - conflicts detection

Post by PavloP » Fri 08 Aug 2014 09:40

We do not plan to change the message text. To handle this exception you can use the message text only. You can use the EDatabaseError class instead of Exception:

Code: Select all

    on foo: EDatabaseError do 

testpresta
Posts: 32
Joined: Sat 07 Jun 2014 19:41

Re: Firebird - conflicts detection

Post by testpresta » Fri 08 Aug 2014 10:50

Thanks for your answer but EDatabaseError is too generic.
I will get this exception if there is a problem with connexion for example.

What i want to do is detect the conflict. I am not sure that checking error message is a good solution... even if you promise me the message will never change...

Thanks

PavloP
Devart Team
Posts: 149
Joined: Fri 24 Jan 2014 12:33

Re: Firebird - conflicts detection

Post by PavloP » Wed 13 Aug 2014 11:38

Unfortunately, to handle this exception you can use the message text only.

Post Reply