Wiki Home

Table File Structure


Namespace: WIN_COM_API
Don't we need permission to post stuff ripped out of the help file?
Nope - you are allowed to quote excerpts from copyrighted works - rule of thumb: up to 10%. -- CFK
I'm not sure this measures up to "Fair Use", since it is available online anyway. *Note...PDF file http://www.loc.gov/copyright/fls/fl102.pdf besides we aren't in Kansas,we are in Canada, their rules apply... Scott

Online help for "Table File Structure"

A table file is made up of a header record and data records. The header record defines the structure of the table and contains any other information related to the table. It starts at file position zero. The data records* follow the header (in consecutive bytes) and contain the actual text of the fields.

The length of a record (in bytes) is determined by summing the defined lengths of all fields. Integers in table files are stored with the least significant byte first.

*The data in the data file starts at the position indicated in bytes 8 to 9 of the header record. Data records begin with a delete flag byte. If this byte is an ASCII space (0x20) the record is not deleted; if the first byte is an asterisk (0x2A) the record is deleted. The data from the fields named in the field subrecords follows the delete flag.

Table Header Record Structure
Byte OffsetDescription
0Type of file:
  • 0x02 - Fox BASE
  • 0x03 - FoxBASE+/dBASE III PLUS, no memo
  • 0x30 - Visual FoxPro
  • 0x31 - Visual FoxPro, autoincrement enabled
  • 0x32 - Visual FoxPro, Varchar, Varbinary, or Blob-enabled
  • 0x43 - dBASE IV SQL table files, no memo
  • 0x63 - dBASE IV SQL system files, no memo
  • 0x83 - FoxBASE+/dBASE III PLUS, with memo
  • 0x8B - dBASE IV with memo
  • 0xCB - dBASE IV SQL table files, with memo
  • 0xF5 - FoxPro 2.x (or earlier) with memo
  • 0xFB - Fox BASE
  • 1 � 3Last update (YYMMDD)
    4 � 7Number of records in file
    8 � 9Position of first data record
    10 � 11Length of one data record (including delete flag)
    12 � 27Reserved
    28Table Flags:
  • 0x01 - file has a structural .cdx
  • 0x02 - file has a Memo field
  • 0x04 - file is a database (.dbc) Note that this byte can contain the sum of
    any of the above values. For example, 0x03
    indicates the table has a structural .cdx
    and a Memo field.
  • 29Code page mark
    30 � 31Reserved, contains 0x00
    32 � nField subrecords
    The number of fields determines the number of field subrecords. There is one field subrecord for each field in the table.
    n+1Header record terminator (0x0D)
    n+2 to n+264A 263-byte range that contains the backlink information (the relative path of an associated database (.dbc)). If the first byte is 0x00 then the file is not associated with a database. Hence, database files themselves always contain 0x00.


    Field Subrecords Structure
    Byte offset Description
    0 � 10 Field name (maximum of 10 characters; if less than 10, it is padded with null character (0x00))
    11 Field Type:
    C 0x43 Character
    Y 0x59 Currency
    N 0x4E Numeric
    F 0x46 Float
    D 0x44 Date
    T 0x54 Date Time
    B 0x42 Double
    I 0x49 Integer
    L 0x4C Logical
    M 0x4D Memo
    G 0x47 General
    C 0x43 Character (binary)
    M 0x4D Memo (binary)
    P 0x50 Picture
    Q 0x51 Varbinary
    V 0x56 Varchar
    V 0x56 Varchar (binary)
    W 0x57 Blob
    12 � 15 Displacement of field in record
    16 Length of field (in bytes)
    17 Number of decimal places
    18 Field Flags
    0x01 System Column (not visible to user)
    0x02 Column can store null values
    0x04 Binary column (for CHAR and MEMO only)
    19 � 32 Reserved

    For information about limitations on characters per record, maximum fields, and so on, see Visual FoxPro System Capacities.



    Remarks

    Visual FoxPro does not modify the header of a file that has been saved to a FoxPro 2.x file format unless one of the following features has been added to the file:



    Q: Is it possible to change table format from VFP to Fox2x without using VFP, by simple file manipulation if the table doesn't use new VFP features?
    A: Yes it can be done by overriding the first byte (offset 0) of the table header with appropriate value.
    Category Reference Category Data
    ( Topic last updated: 2010.03.29 12:17:33 PM )