Choosing the Right Database Driver
Common Database Driver Features
dBaseIV:Supported Commands and Attributes
dBaseIV:Specifications
The dBase4 file driver is compatible with dBase IV. 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.
dBase IV supports multiple index files, whose extension is *.MDX. The miscellaneous section describes procedures for using .MDX files.
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: | ClaDB4L.LIB | Windows Static Link Library |
ClaDB4.LIB | Windows Export Library | |
ClaDB4.DLL | Windows Dynamic Link Library |
dBase IV was never as widely adopted as dBase III. Choose this driver only when you must share data with an end-user using dBase IV.
dBaseIV: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 IV file, you may require additional information for these dBase IV 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('dBase4')
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.
dBaseIV: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
Float: 20 bytes including decimal point
Memo: 64K (see note)
Fields per Record: 512
Field Name: 12 characters
Keys/Indexes per File:
.NDX: No Limit
.MDX 47 tags per .MDX files
Key Sizes
Character: 100 bytes
Numeric, Date: 8 bytes
Memo fields per File: Dependent on available memory
Open Files: Operating system dependent