xBase and Clipper language compatible compiler | ||
---|---|---|
Prev | Chapter 11. Replaceable Database Drivers (RDD) | Next |
There are following subdrivers:
table drivers: DBF, FOX and VFP
index drivers: NTX, CTX, CDX, IDX
memo drivers: DBT, FPT
The following RDDs (in conception of Clipper) consist of these subdrivers:
DBFNTX: DBF + NTX + DBT
DBFCTX: DBF + CTX + DBT
DBFCDX: FOX + CDX + FPT
DBFIDX: FOX + IDX + FPT
SIXCDX: FOX + CDX + FPT synonym for DBFCDX
VFPCDX: VFP + CDX + FPT
CLIP discerns the type of table to be opened using file signature, i.e. the table is opened successfully even if specified table RDD is different. But that does not apply to memo files and indexes.
DBF and FOX drivers are mostly the same. The only difference is file signature for tables with memo (0xF5 with FOX, 0x83 with DBF). VFP driver operates with Visual FoxPro tables. VFP table have different header, and provides some possibilities that are missing in usual DBF format, e.g. possibility of creating binary fields and nullable fields (5th and 6th elements in the field description, used in DBCREATE() and DBSTRUCT()).
All table drivers support all field types, described below.
Table 11-1. Field types
Field type | Identifier(s) | Size in table | Description |
---|---|---|---|
CHARACTER | 'C' | 1 ... 65534 | Character strings |
VARCHAR[a] | 'V' [b] | 1 ... 65534 | Variable length character strings |
NUMERIC | 'N', 'F' [c] | 1 ... 20 | Integers or fractions |
CURRENCY | 'Y'[c]> | 8 | Monetary amounts |
DOUBLE | 'B'[c]> | 8 | Double precision floating point numbers |
INTEGER | 'I'[c]>, 'V(4)'[b]> | 4 | Integer values |
DATE | 'D', 'V(3)'[b]> | 8 (3 bytes with V(3)) | Chronological data consisting of year, month, day |
DATETIME | 'T'[c]> | 8 | Chronological data consisting of year, month, day and time |
LOGICAL | 'L' | 1 | Boolean values of true or false |
MEMO | 'M' | 10 (4 with VFP) | Data of any type [d] with no size limits |
BLOB[e] | 'P'[c]>, 'G'[c]> | 10 (4 with VFP) | Binary data of any type [d]> with no size limits |
VARIANT[f] | 'X' | 10 ... 127 | Data of any xBase type (CHARACTER, NUMERIC, DATE, DATETIME or LOGICAL) |
Notes: a. VARCHAR type allows to store character data of any size. At that, the first <size_of_field> - 6 bytes are stored in .DBF file itself, remaining are stored in MEMO file. In the time of indexing, only those bytes stored in .DBF are used. b. Borrowed from SIx library c. Borrowed from VFP d. Available with FPT memo driver, only CHARACTER with DBT e. BLOB type is always binary, regardless of binary status in field description, passed to DBCREATE() function. f. VARIANT type allows to store the data of any basic xBase type. Character strings can be of size <size_of_field> - 2 (two bytes are reserved for storing type and length). VARIANT fields can be indexed. The order of values of various types in index is as the following: CHARACTER, LOGICAL, DATE, DATETIME, NUMERIC. |
The following table summarizes the availability of key features across index drivers.
Table 11-2. Index features summary
Item | NTX | CTX | IDX | CDX |
---|---|---|---|---|
Order management (tag support) | No | Yes | No | Yes |
Number of orders (tags) per file | 1 | 63 | 1 | No limit |
Number of order bags (files) per work area | No limit | No limit | No limit | No limit |
Conditional indexes (FOR clause) | Yes | Yes | Yes | Yes |
Temporary (partial) indexes (WHILE clause) | Yes | Yes | Yes | Yes |
Descending via DESCENDING clause | Yes | Yes | Yes | Yes |
Unique via the UNIQUE clause | Yes | Yes | Yes | Yes |
EVAL and EVERY clause support | Yes | Yes | Yes | Yes |
Structural indexes | No | Yes | No | Yes |
Maximum key expression length (bytes) | 256 | 256 | 255 | 255 |
Maximum FOR condition length (bytes) | 256 | 256 | 255 | 255 |
Scoped relations support | Yes | Yes | Yes | Yes |
Filter and FOR clause optimization (MachSIx/Rushmore technology) | No | No | Yes | Yes |
There are two memo drivers DBT and FPT. DBT memo files are used with DBFNTX and DBFCTX RDDs. DBT file format is fully compatible with Clipper. FPT memo files used with DBFCDX and DBFIDX RDDs have more powerful format, that can store not only textual data, but any other data. FPT file can store any CLIP data type, including objects, binary data (e.g. images), etc.