Subject Transactions - lock conflict on no wait transaction
Author Robert martin
Hi

We are converting an old BDE based application to Firebird. Are using
the IBODatabase and TDataset descendant components to speed conversion.
At the moment we are using the default transaction in the IBODatabase
component with isolation set to tiCommitted and AutoCommit set to true.

We have just converted a larger user who is getting the following error
messages some times...


ISC ERROR CODE:335544345

ISC ERROR MESSAGE:
lock conflict on no wait transaction
deadlock
update conflicts with concurrent update

STATEMENT:
TIBOInternalDataset: "<TIB_Session>.<TwsQuery>.<TIBOInternalDataset>."

.

TwsQuery is a class descended from TIBOQuery.

I think I have tracked the code to and area where the following occurs.

-Get a list of tables / records to delete

SELECT *
FROM WorkControl
WHERE Status = 'D'

....

- Build a string list of tables related to the current transaction then
loop though them, deleting assoicated reocrds

UpdateQuery.SQL.Text := 'DELETE FROM ' + TablesToDelete[LoopCount] + '
WHERE ControlRef = ' + FieldByName('ControlRef').AsString + ';';
UpdateQuery.ExecSQL;

- Delete stuff from WorkControl
DELETE
FROM WorkControl
WHERE Status = 'D'

My question really is, fir two people try the above delete SQL at the
same time will this cause a 'Deadlock' and if so how do I get around it?

TIA Rob



--
Rob Martin
Software Engineer

phone +64 03 377 0495
fax +64 03 377 0496
web www.chreos.com

Wild Software Ltd