Database Engines:dbespec

CDXDBE (ORDER component) Foundation

The DatabaseEngine CDXDBE manages index files in the CDX format. This file format originated in FoxPro and has undergone changes. By default the CDXDBE supports the CDX file format as defined by Visual-FoxPro.

The major advantage of the CDX file format is its capability of maintaining multiple indexes in one index file. It also supports conditional indexes where only a subset of database records is referenced in the index. This is accomplished by a FOR condition which may be specified on index creation. An overview of the CDXDBE features is given in the following table:

Specifications for CDX files
Element Specification
File size 2 GB (2 * 10^9 Byte)
Data types C, D, L, N, no memo
Max. length for both
- INDEX plus FOR expression 512 characters
- TAG name 10 characters
Indexes per file Not limited
FOR expression Supported
TAG expression Supported
WHILE expression Supported *)
EVAL...EVERY clause Ignored
RECORD clause Ignored
ALL..NEXT..REST clauses Ignored
SET CHARSET Index is based on the ANSI character set
  1. with Xbase++ 1.9 or higher

If a collation table is selected (see SET COLLATION), it is stored in the CDX file. Hence, the sorting order of characters is defined at index creation. This is a crucial change of the CDX file format that Visual FoxPro has introduced. Xbase++ supports this feature, so that Visual FoxPro and Xbase++ applications can share the same CDX files.

The collation table defined by Visual FoxPro differs from the collation table defined by the operating system. Whenever a collation table is active, the CDXDBE is compatible with Visual FoxPro's collation table while the NTXDBE uses the collation table of the operating system. Therefore, the sorting order of characters may slightly differ between CDXDBE and NTXDBE, although (apparently) the same collation table has been selected by SET COLLATION.

Also note that indexes on character expressions become case insensitive once a collation table is selected for the CDXDBE. Again, this behavior is compatible with Visual FoxPro.

Configuration of the CDXDBE with DbeInfo()

The CDX DatabaseEngine is configurable in specific ways using the function DbeInfo(). The following table gives an overview of the special #define constants that can be passed to the function DbeInfo() when the DatabaseEngine is CDXDBE:

Constants for DbeInfo() with the CDX-DBE
Constant *) Value Data type Description
DBE_LOCKMODE a LOCKING_STANDARD #define specifies implicit lock mode
CDXDBE_LOCKRETRY a 100000 N amount of implicit lock retries
CDXDBE_LOCKDELAY a 15 N delay between each lock retry
CDXDBE_MODE a CDXDBE_VFOXPRO #define Operational mode

The default values are shown in the column "Value".


This constant determines the locking mode used to manage implicit locks. Whenever an index is accessed the CDX DatabaseEngine has to lock the CDX file to ensure data consistency. By default DBE_LOCKMODE is set to LOCKING_STANDARD - which ensures Clipper and/or FoxPro compatible behaviour. However this standard locking concept is not efficient in modern network environments. Using LOCKING_EXTENDED increases performance in network environments. This is achieved by mutual exclusion of write operations, however simulataneous read operations are allowed.


This constant determines the amount of lock retry operations before the CDX DatabaseEngine raises a runtime error when performing implicit locks. Implicit locks are set by the CDX DatabaseEngine by each navigational and update operation. The default value is 100.000.


This constant defines the delay in 1/100 seconds between each lock retry operation. The default value is 15 milliseconds. The workstations with a performance lower than the average workstation in the network, should use a delay value lesser than that of the faster workstation in the network. This will give the slower workstation a better chance to obtain a lock.


The CDX DatabaseEngine is designed to be 100% Visual FoxPro compatible. Concurrent usage of CDX files created and maintained by Xbase++ and Visual FoxPro is guaranteed. However a derivation of the Visual FoxPro CDX index format is also used by various Clipper RDDs such as Comix or Six. Using the CDXDBE_MODE constant the CDX DatabaseEngine can be configured to behave excatly as the Comix or DBFCDX RDD. This way concurrent usage of new Xbase++ applications and old Clipper applications in a network is guaranteed.

The following table lists all possible defines to control compatiblity of the CDX DatabaseEngine:

Constant Description
CDXDBE_VFOXPRO Visual FoxPro 5.x and higher
CDXDBE_COMIX Comix for Clipper RDD
CDXDBE_SIX Six for Clipper RDD
CDXDBE_FOXPRO2X FoxPro 2.x compatiblity


Using the constant CDXDBE_VFOXPRO the CDX DatabaseEngine operates in a Visual FoxPro compatiblity mode. Concurrent usage of CDX files between Xbase++ and Visual FoxPro in a network environment is guaranteed. A specific feature of the Visual FoxPro mode of operation is the ability of the CDX DatabaseEngine to compress keys. Compression does reduce the size of the index file and hence increases performance. This mode should be the preferred mode when creating new applications.

Collation tables are case insensitive and follow the collating rules of Visual FoxPro. The collation table itself is stored with each tag of the CDX file. This makes the collation table usage by the CDX DatabaseEngine completely independent of collation table specific runtime settings. Furthermore, by storing each collation table with its tag, the CDX DatabaseEngine enables different collations per table.


This constant used at DbeInfo(), the CDX DatabaseEngine operates in Comix mode. This mode is guaranteed to be Clipper 5.3 and Comix RDD compatible. Keys are not compressed in this CDX file format, leading to a typically larger file size compared to the Visual FoxPro mode. Additionally, original Clipper collation tables are used. However this CDX file format will not store collation tables within the CDX file. Collation table management depends entirely on the Xbase++ runtime settings, such as it was the case with Clipper and Comix.


Reserved for future use, currently identical to CDXDBE_COMIX.


Reserved for future use, currently identical to CDXDBE_COMIX.

If CDX files are opened using OrdListAdd(), DbSetIndex() or SET INDEX TO the specific mode of operation (Visual FoxPro, Comix or Six) is automatically detected. If the index file opened is a FoxPro 2.x compatible IDX index file the CDX DatabaseEngine automatically detects this and switches to IDX compatibility mode. This automatic detection overwrittes possible CDXDBE_MODE settings. However if CDX files are created by Xbase++, CDXDBE_MODE determines the physical file format on disk.


If you see anything in the documentation that is not correct, does not match your experience with the particular feature or requires further clarification, please use this form to report a documentation issue.