Page 1 of 1

TUniSQL+Unidirectional TUniQuery -> Lock

Posted: Tue 28 Apr 2009 09:07
by normancz
Hello,
I have UniDAC 2.50 with a TUniConnection on MySQL, a TUniSQL for inserting data with fetching the autoinc id and a unidirectional TUniQuery for fetching/updating data.

When I using TUniSQL and TUniQuery in the same transaction, i get a lock error. Here a demo code:


UniQuery.Unidirectional := True; // <- the problem

UniConnection.StartTransaction;

UniSQL.SQL.Text := 'insert into foo(bar) values(''hi'')';
UniSQL.Execute;

UniQuery.SQL.Text := 'update foo set bar=''hello'' where id=' +
IntToStr(UniSQL.LastInsertId);
UniQuery.Execute; // <- here it locks

UniConnection.Commit;


Without the unidirectional-flag or with using a second TUniSQL instead of the TUniQuery it works.

Why does it lock? Is it a bug or a feature? Using a TUniSQL for modifying and a unidirectional TUniQuery for fetching only is not so simple on a huge application.

Bye,
Norman

Posted: Thu 30 Apr 2009 09:32
by Dimon
Please make sure that you have the most recent version of UniDAC. If the problem still exists, please send me to dmitryg*devart*com a complete small sample to demonstrate it, including a script to create and fill table.