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