InTransaction using IBQuery + DataSetProvider + ClientDataSet


2004-06-27 05:59:50 PM
delphi138
Hi,
To isolate my problem I have written a little programm that uses a
ClientDataSet to edit records in a Interbase-table.
1. with dbExpress
2. with IBQuery
It opens the cds and in a TDBGrid I edit some records. Then I start
cds.ApplyUpdates.
With dbExpress in TDataSetProvider.InternalApplyUpdates
"IProviderSupport(DataSet).PSInTransaction" results in false.
With Ibx it results in true and that is why the changes aren't commited in
finally of InternalApplyUpdates.
____________________
function TDataSetProvider.InternalApplyUpdates(const Delta: OleVariant;
MaxErrors: Integer;
out ErrorCount: Integer): OleVariant;
begin
CheckDataSet;
FTransactionStarted := not IProviderSupport(DataSet).PSInTransaction;
if FTransactionStarted then
IProviderSupport(DataSet).PSStartTransaction;
try
CheckResolver;
Resolver.FUpdateTree.InitData(DataSet);
try
Result := inherited InternalApplyUpdates(Delta, MaxErrors,
ErrorCount);
finally
Resolver.FUpdateTree.InitData(nil);
end;
finally
if FTransactionStarted then
IProviderSupport(DataSet).PSEndTransaction((ErrorCount <= MaxErrors)
or (MaxErrors = -1));
end;
end;
____________________
The solution seems me to send a extra commit after opening the cds or
before ApplyUpdates.
Is this the only solution or what is the better way.
--
All the Best
Karl Palm