I have TClientDataSet, TDataSetProvider and TIBQuery chain and there is 'unprepared statement' error while executing CDS.Post, apparently, the update satement generated by TDataSetProvider is wrong. How to catch this update SQL? SQL Montioring is not working for my IBX components. I have tried to use code (inspired by TClientDataset.ApplyUpdates fails with 'SQL not supported' when using SQLDirect components):
procedure TSQLResolver.DoExecSQL(SQL: TWideStringList; Params: TParams);
var
RowsAffected: Integer;
TmpList: TStringList;
begin
TmpList:=TStringList.Create;
TmpList.LoadFromFile('C:\Test\test.txt');
RowsAffected := (Provider.DataSet as IProviderSupport).PSExecuteStatement(SQL.Text, Params);
if not (poAllowMultiRecordUpdates in Provider.Options) and (RowsAffected > 1) then
begin
TmpList.Add(SQL.Text);
TmpList.SaveToFile('C:\Test\test.txt');
TmpList.Free;
(Provider.DataSet as IProviderSupport).PSEndTransaction(False);
Provider.TransactionStarted := False;
DatabaseError(STooManyRecordsModified);
end;
if RowsAffected < 1 then
DatabaseError(SRecordChanged);
end;
But nothing is written in the Test/test.txt file. Where can I put such logging code?
Delphi 2010 but I guess that this applies to any version of Delphi.