Fields, Strings and Dates

Chapter Updated 06/27/25




The main objective of this chapter is to provide basic information regarding field types supported by the library.



Xbase64 Versions

dBASE VersionFile LevelXbase64 ClassField Name Max SizeMemo File Version
III+5xbDbf310III
IV5xbDbf410IV
55xbDbf510IV
7 and higher7xbDbf731IV


Notes on the different versions

  • Level 5 and Level 7 files are not interchangable.
  • If you are supporting older dbf file types, pick the appropriate level for your application.
  • If you are working on a net new project and attempting to maintain a minimal footprint with limited functionality, try using Version 3 and turn off support for everything you don't need when compiling the library.
  • If you are working on a new project and want maximum functionality, choose version 7 with all library compile options turned on.
  • If you want it all, enable everything (default).


    DBF Field Types

    TypeSizeAllowable ValuesXbase64 Schema ValueLeveldBASE
    III
    dBASE
    IV
    dBASE
    V
    dBASE
    VII
    Clipper
    5
    Character0 - 254AnythingXB_CHAR_FLD (C)5,7XXXXX
    Numeric0 - 17(include sign and decimal point+ - . 0 through 9XB_NUMERIC_FLD (N)5,7XXXXX
    Date8CCYYMMDDXB_DATE_FLD (D)5,7XXXXX
    Logical1Y y N n T t F fXB_LOGICAL_FLD (L)5,7XXXXX
    MemoFixed length portion - 10
    Variable length 0 - 32760
    Type III - Text
    Type IV - Anything
    XB_MEMO_FLD (M)5,7XXXXX
    Floating Point0 - 17 (includes sign and decimal point+ - . 0 through 9XB_FLOAT_FLD (F)5,7XXX
    OLEFixed length portion - 10
    Variable length max 2G
    Object Linking and Embedding, Links to objectsXB_OLE_FLD (G)5,7XX
    BinaryFixed length portion - 10
    Variable length max 2G
    Binary DataXB_BINARY_FLD (B)5,7XX
    LongFixed length portion - 432 bit long integersXB_LONG_FLD (I)7X
    DateTimeFixed length portion - 8Date and time
    Number of milliseconds since 01/01/0001
    XB_TIMESTAMP_FLD (@)7X
    DoubleFixed length portion - 8Floating point numbersXB_DOUBLE_FLD (O)7X
    AutoIncrementFixed length portion - 4Auto increment fieldXB_AUTOINCREMENT_FLD (+)7X



    New table (dbf) Definition

    Field names and charactersitics are defined when a dbf data file is initially created. If field characteristics need revision after the file is initially created, define a new version of the table and copy existing data from the old table to the new table.

    Fields and Field Numbers

    The Xbase64 routines can access field data via using field names or field numbers. Field numbers are numbered 0-n where the first field in a datafile is field 0 going through the last field n. Accessing fields by number is slightly more efficient than accessing by name as the routines ultimately need to determine a field number to access the data in the file.

    Strings

    Xbase64 includes support for a string class xbString. The xbString class interface was originally derived from the Draft Standard C++ Library by P.J. Plauger and significantly modified. If you are familiar with other string classes, this one should be similar. Strings can be used to manage strings of character data. See the xbString class for more inforomation.

    Date Fields

    Date fields are stored in the .DBF files as Gregorian dates with format CCYYMMDD and the library date routines work with dates formated with the same CCYYMMDD format.
  • Date fields in the database stored as eight spaces are considered null dates.
  • The library can effectivly handle leap years and leap centuries.
  • Julian dates are supported.
  • See class xbDate for a wide range of functionality for processing date values.

    Memo, OLE and Blob Fields

  • Memo fields are supported in all versions of the software. OLE and Blob fields are supported beginning with Version 5 and use the version 4 memo format.
  • Memo, OLE and Blob fields are variable length data fields which are stored in two parts. This first part is a ten byte field which is stored in the fixed length record of the .DBF file. The variable data is stored in a seperate .DBT file in 512 byte blocks. The ten byte field in the fixed length portion of the record points to a .DBT block number.
  • There are two versions of memo data files. Version 3 supports the older version that does not support space reclamation and versions 4 and greater use the newest format which does include space reclamation of discarded blocks.
  • The xbString class can be used for manipulating string data which is terminated with a null terminating byte.
  • The xbBlob class can be used for supporting binary and OLE data types. The xbBlob class can support an object up to 2G in size, providing it is running on a strong enough machine and OS to provide that level of memory requirement.

    Double

    Available starting with version 7. Eight byte floating point field.

    AutoIncrement

    Available starting with version 7. Long integer field that auto increments when appending a new record.

    TimeStamp

    Available starting with version 7. Field is comprised of two long integer fields. The first represents the number of days since 1//1/4713 BC and the second is the number of seconds since midnight.

    Long

    Available starting with version 7. Four byte unsigned long integer field.