Control Name | Unit | Class |
RX Memory Table | MemTable | TMemoryTable |
Description:
Memory tables are
tables created in memory (RAM) and the contents are deleted when
you close them. They are much faster and are very useful when you
need fast operations on small tables. Memory tables do not
support certain features (like referntial integrity, indexes,
autoincrement fields and BLOBs).
Only standard (logical) BDE field types are supported by the
in-memory table. "Physical" field types are not
supported. The table is kept in memory if possible, but it could
be swapped to disk if the table becomes too big.
The maximum table size is 512Mb with a maximum record size of
16Kb with a maximum of 1024 fields.
Please note that Logical Auto-increment and BLOB fields are not
supported due to their nature of operations.
Using class TMemoryTable
Use TMemoryTable to create a "temporary" table never intended to be written to disk. These tables are created by the application for gathering information that is needed temporarily during processing. These tables can be created only with logical types. These tables do not support indexes.
Before create in-memory table you
must specify the table structure by adding fields in Dataset
Designer (at design time) or by using FieldDefs property (at run
time). To create table you need call the CreateTable or Open
method (or assign True value to the Active property).
When the table is closed (by the Close method or assigning Active
:= False), all data in the memory table will be lost.
The TMemoryTable component provides live access to temporary in-memory BDE tables.
Property
EnableDelete
Declaration: EnableDelete: Boolean;
If True (the default), the application can delete the current record by using Delete method.
If False, TMemoryTable won't delete records (it is read-only (aka dBase)).
Property
RecNo
Declaration: RecNo: Longint;
The RecNo property Indicates the
current record in the TMemoryTable.
Use RecNo to determine the record
number of the current record in the table. Applications might use
this property with RecordCount to iterate through all
the records in a in-memory table, though typically record
iteration is handled with calls to First, Last, MoveBy, Next, and
Prior.
RecNo also can be set to a specific record number to position the cursor on that record. You can also position the cursor on the specified record by using GotoRecord method.
Method
BatchMove
Declaration: function BatchMove(ASource: TDataSet;
AMode: TBatchMode; ARecordCount: Longint): Longint;
The BatchMove method copies or
appends records in the TMemoryTable. ASource is a Table or Query
linked to a database table containing the source records. AMode
is the copy mode; it can be only batAppend or batCopy.
The ARecordCount parameter is used to control the maximum number
of records that will be moved. If zero, all records are moved,
beginning with the first record in ASource. If ARecordCount is
not zero, a maximum of ARecordCount records will be moved,
beginning with the current record. If ARecordCount exceeds the
number of records remaining in ASource, no wraparound occurs; the
operation is terminated. BatchMove returns the number of records
operated on.
Method
CopyStructure
Declaration:
procedure CopyStructure(ASource: TDataSet);
This method allows you copy field
structure from another dataset ASource to the in-memory table.
After copying call Open or set Active property to True to
activate in-memory table with new structure.
Method
GotoRecord
Declaration: procedure GotoRecord(RecordNo: Longint);
Use this method to position the cursor on record, specified by the sequence number RecordNo. First record in the in-memory table has number 1.
Method
SetFieldValues
Declaration: procedure SetFieldValues(const FieldNames:
array of string; const Values: array of const);
SetFieldValues enables you to perform updates on entire in-memory table. This method sets all fields passed in the FieldNames parameter to the new field values passed in the Values parameter. The assignment of the elements of Values to fields in the FielsNames is sequential; the first element is assigned to the first field, the second to the second, etc.
Index Page | About | Download
Creation Date: 4 Feb 1998 | Last Update: 16 Mar 2000