Page 1 of 1

Firebird - conflicts detection

Posted: Tue 05 Aug 2014 19:40
by testpresta
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

Re: Firebird - conflicts detection

Posted: Fri 08 Aug 2014 09:40
by PavloP
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 

Re: Firebird - conflicts detection

Posted: Fri 08 Aug 2014 10:50
by testpresta
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

Re: Firebird - conflicts detection

Posted: Wed 13 Aug 2014 11:38
by PavloP
Unfortunately, to handle this exception you can use the message text only.