TUniSQL+Unidirectional TUniQuery -> Lock

Discussion of open issues, suggestions and bugs regarding UniDAC (Universal Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
normancz
Posts: 5
Joined: Tue 28 Apr 2009 07:31

TUniSQL+Unidirectional TUniQuery -> Lock

Post by normancz » Tue 28 Apr 2009 09:07

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

Dimon
Devart Team
Posts: 2910
Joined: Mon 05 Mar 2007 16:32

Post by Dimon » Thu 30 Apr 2009 09:32

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.

Post Reply