Skip to content

Commit

Permalink
Merge pull request #13 from mateusvicente100/master
Browse files Browse the repository at this point in the history
Do not open an dataset with zero fields
  • Loading branch information
viniciussanchez authored Aug 20, 2019
2 parents c6d6e72 + b047522 commit c97e5b3
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions src/core/RESTRequest4D.Request.pas
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,10 @@ procedure TRequest.ActiveCachedUpdates(const ADataSet: TDataSet; const AActive:
if ADataSet is TFDMemTable then
begin
if not AActive then
TFDDataSet(ADataSet).Close;
TFDDataSet(ADataSet).CachedUpdates := AActive;
if not AActive then
TFDDataSet(ADataSet).Open;
TFDMemTable(ADataSet).Close;
TFDMemTable(ADataSet).CachedUpdates := AActive;
if AActive and not TFDMemTable(ADataSet).Active then
TFDMemTable(ADataSet).Open;
end;
ADataSet.GetDetailDataSets(LDataSetDetails);
for LDataSet in LDataSetDetails do
Expand Down Expand Up @@ -126,9 +126,7 @@ destructor TRequest.Destroy;
procedure TRequest.DoAfterExecute(Sender: TCustomRESTRequest);
begin
if not Assigned(FDataSetAdapter) then
Exit;
if not FDataSetAdapter.Active then
FDataSetAdapter.Open;
Exit;
ActiveCachedUpdates(FDataSetAdapter, False);
FDataSetAdapter.LoadFromJSON(FRESTResponse.Content);
ActiveCachedUpdates(FDataSetAdapter);
Expand Down

0 comments on commit c97e5b3

Please sign in to comment.