Choosing the Right Database Driver
Common Database Driver Features
Clipper:Supported Commands and Attributes
Clipper:Specifications
The Clipper file driver is compatible with Clipper Summer '87 and Clipper 5.0. 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 *.NTX.
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: | ClaCLPL.LIB | Windows Static Link Library |
ClaCLP.LIB | Windows Export Library | |
ClaCLP.DLL | Windows Dynamic Link Library |
As a popular xBase database application development system, Clipper provides a common file format for many installed business applications and their data files. Use the Clipper driver to access these files in their native format.
Clipper: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 data types, which the driver converts automatically.
Clipper 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 Clipper file, you may require additional information for these Clipper 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('Clipper')
Memo1 MEMO(200),NAME('Notes')
Memo2 MEMO(200),NAME('Text')
Rec RECORD
Mem1Ptr LONG,NAME('Notes')
Mem2Ptr STRING(10),NAME('Text')
END
END
Whenever possible, use the File Import Utility in the Dictionary Editor to define your files.
Clipper:File Specifications/Maximums
File Size: 2,000,000,000 bytes
Records per File: 1,000,000,000
Record Size: 4,000 bytes (Clipper '87)
8,192 bytes (Clipper 5.0)
Field Size
Character: 254 bytes (Clipper '87)
2048 bytes (Clipper 5.0)
Date: 8 bytes
Logical: 1 byte
Numeric: 20 bytes including decimal point
Memo: 65,520 bytes (see note)
Field Name: 10 characters
Fields per Record: 1024
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