Watch, Follow, &
Connect with Us

For forums, blogs and more please visit our
Developer Tools Community.


ID: 12458, Prevent refetching detail records unnecessarily

by Dan Miser Email: Anonymous


Download Details
FTP  download also available 0 bytes
CDN Login Required to Download. (You will be redirected to the login page if you click on the Download Link)
To download this, you must have registered:
A free membership

For Delphi, Version 1.0  to 2.0 20 downloads
Copyright: No significant restrictions


Size: 0 bytes
Updated on Fri, 14 May 1999 00:00:00 GMT
Originally uploaded on Fri, 14 May 1999 00:00:00 GMT
Description
DBCLIENT.PAS
// Fixes refetch of detail records when deleting all detail records with client-side master/detail
procedure TClientDataSet.CheckDetailRecords;
var
I, RecCount: Integer;
MasterValues: OleVariant;
Status: DBIResult;

function DeletedRecords: boolean; (**) (* Dan Miser (99-04-15): Add this nested procedure *)
var
CDS: TClientDataset;
MasterValues: OleVariant;
I: integer;
begin
Result:=false;
if (not Active) or (ChangeCount=0) then EXIT; // ChangeCount for D3 compatibility
CDS:=TClientDataset.Create(nil);
try
CDS.Data:=Delta;
if FMasterLink.Fields.Count=1 then
MasterValues:=TField(FMasterLink.Fields[0]).Value
else
begin
MasterValues:= VarArrayCreate([0, FMasterLink.Fields.Count - 1], varVariant);
for I := 0 to FMasterLink.Fields.Count - 1 do
with TField(FMasterLink.Fields[I]) do
MasterValues[I] := Value;
end;
if CDS.Locate(FMasterLink.FieldNames, MasterValues, []) and (CDS.UpdateStatus=usDeleted) then
Result:=true;
finally
CDS.Free;
end;
end;
...
if (RecCount = 0) and Assigned(FProvider) and not ProviderEOF and
(FPacketRecords = 0) and not MasterSource.DataSet.IsEmpty and
(MasterSource.DataSet.State <> dsInsert)
and not DeletedRecords then (**) (* Dan Miser (99-04-15): Add the call to DeletedRecords *)

   Latest Comments  View All Add New

Move mouse over comment to see the full text

Could not retrieve comments. Please try again later.

Server Response from: ETNACDC03