<< Click to Display Table of Contents >> Navigation: Apollo VCL Components > Apollo VCL Component Reference > TApolloTable > TApolloTable Methods > ApolloGetRecord |
Declaration
procedure ApolloGetRecord( cpRecord: PChar );
Description
Fills a defined and initialized buffer or record structure with the contents of the current record buffer.
To avoid a naming conflict with TDataSet.GetRecord, the old TApollo.GetRecord method has been renamed to ApolloGetRecord in this release.
Parameters
cpRecord: A pointer to a defined record structure (typedef) or a pre-dimensioned array of Char types. The record structure must include a delete flag field (1 character) as the first field. If using an array of Char types, ensure that enough space has been allocated for the entire record including the hidden deletion flag field.
DBF xBase data is stored in character format. Numeric fields are saved as right justified numbers. Date fields are stored as CCYYMMDD. Memo fields are ten digit numbers that refer to the relative block number of the memo in the .DBT/FPT/SMT file. The first character in the record is a delete flag ('*' if deleted, blank if not).
Data Typing Note
All elements within a defined record type must be fixed length character strings. The extracted field elements will not be terminated with binary zeroes. Numeric fields must be converted from character to the required numeric type. Dates are stored as 'CCYYMMDD'.
Encrypted Records
If the record has been encrypted, the deletion flag in the first byte of the record will be 'D' for deleted records, and 'E' for normal non-deleted records. The record data will not be in encrypted if the correct password has been set.
Field Offsets
To retrieve field data from a record that has been read into a string, use FieldOffset to set the start position of the field in the string.
Delphi Example
procedure Form1.Button1Click(Sender: TObject);
var
caString: Array[0..255] of Char;
begin
with ApTbl do
begin
GoTop;
while not Eof do
begin
ApolloGetRecord( caString );
// If record is not deleted, copy it
if StrLComp( caString, '*', 1 ) <> 0 then
begin
ApDS2.AppendBlank;
ApDS2.Post; // Must write out empty record first
ApDS2.PutRecord( caString );
end;
Skip( 1 );
end;
end;
end;
See Also