Board index » off-topic » RDM OnGetData LogChanges problem

RDM OnGetData LogChanges problem

2006-02-27 07:18:17 PM
RDM OnGetData LogChanges problem
I am having a strange problem with the LogChanges property of a
DataSetProvider in a RemoteDataModule.
BDS2006 SP1, Delphi Win32 VCL
ADO access to MS SQL Server 2000
The client program has a TClientDataSet connected to a
TConnectionBroker, connected to a TDCOMConnection. The provider name
is "AgentAccuracyRptPrv".
The application tier has a TDataSetProvider named
"AgentAccuracyRptPrv" connected to a TADODataSet connected to a
TADOConnection which reads from MS SQL Server 2000.
The Providers has an OnGetData event that modifies the DataSet to do
some complex data manipulation that could not be done in SQL. Since
this data is to be used for reporting only, there will never be any
need to post changes back to the server.
The problem is that when dataset.logChanges is set to true, everything
works fine but the program runs very slow. When I set LogChanges to
false, the program runs very fast, but the client does not get the
changes. The client gets the original dataset before any changes are
I am wondering if I am misunderstanding something here. I had thought
that setting logChanges to false would only have the impact of not
writing a delta. What am I missing?

Re:RDM OnGetData LogChanges problem

Jim Michels wrote:
RDM OnGetData LogChanges problem

This should probably be a bug inside TBaseProvider.DoOnGetData
implementation and in this snippet in particular:
1: if FDataDS.ChangeCount>0 then
2: begin
3: FDataDS.MergeChangeLog;
4: Data := FDataDS.Data;
5: end;
where Data is a var parameter. Line 4 should probably be outside the
begin/end block. OTOH, they may be did this in purpose (for a reason I
can't imagine of).
You have 2 options at this point.
1) Alter provider.pas (Move line 4 outside the begin/end block) and
rebuild (In this case you don't have the option of using runtime
packages). You should test this option though, to avoid having
unpredictable behavior
2) Don't make a lot of changes inside OnGetData handler and live
DataSet.LogChanges to default value (true) (this is probably what slows
down the app as you noticed).
Feel free to log a QC report if you think this is a show stopper for you

Re:RDM OnGetData LogChanges problem

Kostas, I appreciate the help.
I will be using this technique frequently in reporting,
so I will log a QC report.


Re:RDM OnGetData LogChanges problem

The following information is provided to assist anyone else who might
read this thread.
The Quality Central number for this item is 25509
The work around options for this problem are:
1) Always leave LogChanges set to true
2) Modify provider.pas
procedure TBaseProvider.DoOnGetData
3) Make sure that the ChangeCount of the dataset is>0
I am using the third option. After making the bulk of the changes to
the dataset with LogChanges set to false, I set it to true and then
make one change to the dataset so that the ChangeCount is 1. Then
everything works fine.