FIELD Definitions

 

<< Click to Display Table of Contents >>

Navigation:  Getting Started >

 

FIELD Definitions

 

Previous pageReturn to chapter overviewNext page

 

 

 

Unlike DBF files, Btrieve tables have no built-in file structure. Thus it is necessary that you pass the file structure when opening tables. You can pass the Btrieve file structure as an array of Btfield objects, a single string <cStructure> or as an array of strings <aStructure>. In the 2 last cases the file structure must be specified in a series of 32-byte entries, one for each field. The format for each entry is:

 

<name(20)><type(2)><length(5)>.<dec(2)><fil(1)>; where:

<name> is the field name. Maximum length is 20 characters.
<type> is the two-character code for the field's Btrieve data type. Type codes can be found at the documentation of the Bt_CvType function.
<length> is a five-digit internal field length. Leading zeros may be suppressed and the number may be left-justified. Valid lengths are listed in the chart below. For a variable length field (M or ML), specify the maximum length of the field. Keep this number as low as you reasonably can. Doing so will not affect disk space but it will use memory more efficiently.
<dec> is the number of digits after the decimal point. Leading zeros may be suppressed, and the number may be left-justified. Meaningless for non-numeric fields.
<fil> is a one byte filler that is reserved for future use. Leave blank.
";" is a trailing semicolon and is required.

 

Each field must have its own entry, and each entry must be exactly 32 bytes long. Fields must be defined in exactly the order in which they appear in the Btrieve table. If there is a filler at the end of a record, that must be accounted for, too.