Sunday, March 1, 2009

How to use DBFCDX in Xbase++ ?

CCH : This is a good posting by Clayton Jones on 10th July 2008 in the Alaska public.xbase++.clipper-migration newsgroup about using DBFCDX in a Xbase++ application


Jorge : can anybody tellme if this definition generate indexes 101% compatible with clipper 5.2
dbeSetDefault( 'DBFCDX' )
dbeInfo( COMPONENT_ORDER, CDXDBE_MODE, CDXDBE_COMIX )

Clayton :

I'm not sure about 101% but this does create index files compatible with Clipper 5. The main thing is this line creates CDX index files without an internal collation table. This DBFCDX configuration will still use Clipper DBFs with DBT memo files.

If the full Comix RDD is needed (FPT memo files) the DBF side of the DBE must also be configured. This requires two more lines

dbeinfo(COMPONENT_DATA,FOXDBE_LOCKMODE,FOXDBE_LOCKMODE_2X)
dbeinfo(COMPONENT_DATA,FOXDBE_CREATE_2X,.T.)

These lines set the lockmode and make it create DBF files with the proper signature byte and FPT memo files. This combination is Fox 2x compatible. Here is the full code to set this up

******** FOX Data Component
IF ! DbeLoad( "FOXDBE", .T.) // hidden
MsgBox("Database engine FOXDBE not loaded")
ENDIF

************** CDX Order Component
IF ! DbeLoad( "CDXDBE",.T.) // hidden
Msgbox("Database engine CDXDBE not loaded")
ENDIF

******* Build FOX/CDX engine
IF ! DbeBuild( "FOXCDX", "FOXDBE", "CDXDBE" )
MsgBox("FOXCDX database engine could not be created")
ENDIF

dbeSetDefault("FOXCDX")

******* Configure for Clipper/Comix
dbeInfo( COMPONENT_ORDER, CDXDBE_MODE, CDXDBE_COMIX )
dbeinfo(COMPONENT_DATA,FOXDBE_LOCKMODE,FOXDBE_LOCKMODE_2X)
dbeinfo(COMPONENT_DATA,FOXDBE_CREATE_2X,.T.)

I hope this helps.


Regards,
Clayton

Clayton Jones www.cjcom.net
Top-Down Library for Xbase++
X-DBU Database Utility
X-MEMO Memo Field Replacement

No comments:

Post a Comment