since the update there are problems with the order of column names in update statements with the class TUniUpdateSQL. If several columns with the same name are selected from different tables in the query, also using aliases. If Modify SQL is used, the first column is always used for the parameters. Even if the alias is completely different.
Example:
[<TUniUpdateSQL>.ModifySQL]
Code: Select all
update TABLE1 T1
set T1 = :COLUMN1,
where T1.PRIMARYKEY1 = :PRIMARYKEY1 and
T1.PRIMARYKEY2 = :PRIMARYKEY2
[<TUniQuery>.SQL.Text]
Code: Select all
select T2.COLUMN1 as T2_COLUMN1, T1.COLUMN1, T1.PRIMARYKEY1, T1.PRIMARYKEY2
from TABLE1 T1
left outer join TABLE2 T2 on T2.PRIMARYKEY1 = T1.PRIMARYKEY1 and
T2.PRIMARYKEY2 = 1
SourceCode
Code: Select all
<TUniQuery>.CachedUpdates := True;
<TUniUpdateSQL>.DataSet := <TUniQuery>;
....
<TUniQuery>.Edit;
<TUniQuery>.FieldByName('Column1').AsInteger := 100;
<TUniQuery>.Post;
<TUniQuery>.ApplyUpdates;
<TUniUpdateSQL>.Apply(ukModify);
Because the <TUniQuery>.FieldByName('Column1') was set, I would have expected that T1.COLUMN1 would be used.
For T2.COLUMN1 as T2_COLUMN1 the value from <TUniQuery>.FieldByName('T2_COLUMN1') should be used accordingly.
In version "7.4.12" the behaviour was still correct in my opinion. But at least since version "8.1.2" the behaviour is as described.
Is this a bug or are there possibly new properties to control this?