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 ...
A: The TADMemTable has the similar functionality. But it follows to the »Cached Updates« model. When CachedUpdates property value is True, then memtable will record changes in the updates journal.
To post updates to a DB you have to use ApplyUpdates. To "merge change log" you have to call CommitUpdates.
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[0].AsInteger := ...; Fields[1].AsString := ...; Post; end; .....
2) Append data to it, browse / edit it.
A: The most simple way to copy the structure and the data from a TDataSet to a TADMemTable is to use the CopyDataSet method:
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!
|