TFDMemTable已修改的数据序列为流

TFDMemTable已修改的数据序列为流

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
uses FireDAC.Stan.Intf, FireDAC.Comp.Client;
 
function fdmemtable2stream(fdmemtable: TFDMemTable): TStream;
begin
  fdmemtable.CachedUpdates := True;
  Result := TMemoryStream.Create;
  if fdmemtable.State in dsEditModes then
    fdmemtable.Post;
  if fdmemtable.ChangeCount = 0 then
    Exit;
  fdmemtable.ResourceOptions.StoreItems := [siDelta, siMeta];
  try
    fdmemtable.SaveToStream(Result, TFDStorageFormat.sfBinary);
    Result.Position := 0;
  finally
    fdmemtable.ResourceOptions.StoreItems := [siDelta, siMeta, siData];
  end;
end;

  

posted @   delphi中间件  阅读(751)  评论(0编辑  收藏  举报
努力加载评论中...
点击右上角即可分享
微信分享提示