and optionaly DetailTable.MasterParamsMappings.Text :=DetailTable.DetailFields +‘=’ +
This works in our application but when we used shared dataadapters a detail fetch sometimes fails because a previous request to the dataadapter set some DA parameter.
At some point another DATable executes a remote fetch but it sets a getdatacall parameter
roParam:=DARemoteDataAdapter.GetDataCall.FindParam(‘ExtraWhere’);
if roParam<>nil then
roParam.Value:=newValue;
However the detail DA table does not have this parameter (and definately does not want to add some extra where clause)
How can we clear GetDataCall parameters for all the detail table remote fetches
Note: If we don’t share data adapters between DATables we do not have the issue but the code is very slow.
Each LoadSchema takes 0.2 seconds and we have many places where DATable’s (dataadapters) get created
I also thought about caching the schemas but didn’t know how.
How do you propose to cache?
A simple global singleton TDAClientSchema which starts as nil and once set can always use the cached singleton?
I can consider the schema as an immutable object? As long as the server hasn’t changed the returned schema will be identical? The data adapter itself does not modify/lock/…
fSchema: TDAClientSchema;
function GetSchema: TDAClientSchema; override;
property Schema: TDAClientSchema read GetSchema;
...
function TDABaseDataAdapter.GetSchema: TDAClientSchema;
begin
Result := ReadSchema(not fCacheSchema);
end;
function TDABaseDataAdapter.ReadSchema(aForceReRead: Boolean): TDAClientSchema;
begin
...
Result := fSchema;
end;
new GetSchema method doesn’t touch this variable and just replaces value of schema on-fly:
function TMyDARemoteDataAdapter.GetSchema: TDAClientSchema;
begin
Result := masterRDA.Schema;
end;