Choosing the Right Database Driver
Common Database Driver Features
dBaseIII:Supported Commands and Attributes
dBaseIII:Specifications
The dBase3 file driver is compatible with dBase III. The default data file extension is *.DBF.
Keys and Indexes exist as separate files from the data file. Keys are dynamic–they automatically update as the data file changes. Indexes are static–they do not automatically update, but instead require the BUILD statement for updating. The default file extension for the index file is *.NDX. International sort orders are supported.
The driver stores records as fixed length. It stores memo fields in a separate file. The memo file name takes the first eight characters of the File Label plus an extension of .DBT.
Files: | ClaDB3L.LIB | Windows Static Link Library |
ClaDB3.LIB | Windows Export Library | |
ClaDB3.DLL | Windows Dynamic Link Library |
dBaseIII:Data Types
The xBase file format stores all data as ASCII strings. You may either specify STRING types with declared pictures for each field, or specify native Clarion types, which the driver converts automatically.
dBase data type | Clarion data type | STRING w/ picture |
Date | DATE | STRING(@D12) |
*Numeric | REAL | STRING(@N-_p.d) |
*Logical | BYTE | STRING(1) |
Character | STRING | STRING |
*Memo | MEMO | MEMO |
If your application reads and writes to existing files, a pictured STRING will suffice. However, if your application creates a dBase III file, you may require additional information for these dBase III types:
* To create a Numeric field in the Data Dictionary, choose the REAL data type. In the External Name field on the Attributes tab, specify 'NumericFieldName=N(Precision,DecimalPlaces)' where NumericFieldName is the name of the field, Precision is the precision of the field and DecimalPlaces is the number of decimal places. With a REAL data type, you cannot access the Character or Places fields in the Field definition, you must specify those attributes with an expression in the External Name Field on the Attributes tab.
For example, if you want to create a field called Number with nine significant digits and two decimal places, enter 'Number=N(9,2) in the External Name field on the Attributes tab of the Field properties in the Data Dictionary.
If you're hand coding a native Clarion data type, add the NAME attribute using the same syntax.
If you're hand coding a STRING with picture, STRING(@N-_9.2), NAME('Number'), where Number is the field name.
* To create a logical field, using the data dictionary, choose the BYTE data type. There are no special steps; however, see the miscellaneous section for tips on reading the data from the field.
If you're hand coding a STRING with picture, add the NAME attribute: STRING(1), NAME('LogFld = L').
To create a date field, using the data dictionary, choose the DATE data type, rather than LONG, which you usually use for the TopSpeed or Clarion file formats.
* MEMO field declarations require the a pointer field in the file's record structure. Declare the pointer field as a STRING(10) or a LONG. This field will be stored in the .DBF file containing the offset of the memo in the .DBT file. The MEMO declaration must have a NAME() attribute naming the pointer field. An example file declaration follows:
File FILE, DRIVER('dBase3')
Memo1 MEMO(200),NAME('Notes')
Memo2 MEMO(200),NAME('Text')
Rec RECORD
Mem1Ptr LONG,NAME('Notes')
Mem2Ptr STRING(10),NAME('Text')
END
END
Use the File Import Utility in the Clarion Dictionary Editor to define your files.
dBaseIII:File Specifications/Maximums
File Size: 2,000,000,000 bytes
Records per File: 1,000,000,000
Record Size: 4,000 bytes
Field Size
Character: 254 bytes
Date: 8 bytes
Logical: 1 byte
Numeric: 20 bytes including decimal point
Memo: 64K (see note)
Fields per Record: 128
Field Name: 10 characters
Keys/Indexes per File: No Limit
Key Sizes
Character: 100 bytes
Numeric, Date: 8 bytes
Memo fields per File: Dependent on available memory
Open Files: Operating system dependent