The list of questions and answers related to TADMemTable.
A: It is MUCH faster.
2 years ago we have posted this article. There you can find "Speed" section and the screen snapshot with benchmark results. The ADClientDataSet is AnyDAC v 1 in-memory table. So, the post is about AnyDAC v 1, but AnyDAC v 2 is faster than v 1.
As you can see TClientDataSet is extremely slow dataset ...
You can find description of these and other methods in the AnyDAC help file and the examples in the AnyDAC\Samples\Comp Layer\TADMemTable folder.
A: Use the following code:
ADMemTable1.CloneCursor(ADQuery1, False, False);
A: 1) Create the in-memory dataset
with ADMemTable1.FieldDefs do begin with AddFieldDef do begin Name := 'f1'; DataType := ftInteger; end; with AddFieldDef do begin Name := 'f2'; DataType := ftString; Size := 50; end; end; with ADMemTable1 do begin Open; Append; Fields.AsInteger := ...; Fields.AsString := ...; Post; end; .....
2) Append data to it, browse / edit it.
ADMemTable1.CopyDataSet(DataSet1, [coStructure, coRestart, coAppend]);
A: You can do something like that:
// UniDirectiona must be false if no ADQuery1.FetchOptions.Undirectional := False; ADQuery1.Open; ADQuery1.FetchAll; ADMemTable1.Data := ADQuery1.Data; ADMemTable1.First; while not ADMemTable1.Eof do begin ADMemTable1.Edit; ....... ADMemTable1.Post; ADMemTable1.Next; end;
A: That is known issue in DB.pas unit: http://qc.embarcadero.com/wc/qcmain.aspx?d=8008. The workaround is to create a GUID field at runtime.
What do you think about this topic? Send feedback!