
#include 'CdxDbe.ch'
#include 'DbfDbe.ch'
#include 'FoxDbE.ch'
#include 'NtxDbe.ch'
#include 'Set.ch'
#include 'Collat.ch'
  ////////////
  //   DbeSys.prg

  /////
PROCEDURE DbeSys()
                  //
                  //    Set Collation for usage in DbeInfo(COMPONENT_ORDER, CDXDBE_MODE, CDXDBE_VFOXPRO)
Set(_SET_COLLATION, COLLAT_ASCII)
                  //
                  //    Basic DBEs
                        //       DBF
DbeLoad('dbfdbe', .t.)                             // Common DBF
DbeLoad('foxdbe', .t.)                             // FoxPro and FoxPro 2.x compatibility
                        //       Indexes
DbeLoad('ntxdbe', .t.)                             // NTX
DbeLoad('cdxdbe', .t.)                             // CDX
                  //
                  //    Dbe's for processing data and indexes
if !DbeBuild('DbfNtx', 'dbfdbe', 'ntxdbe')          // 'DbfNtx' := DBF com índices NTX
   Stop_('DBFNTX Database-Engine: could not build engine', .f.)
else
   DbeInfo(COMPONENT_DATA , DBFDBE_LOCKRETRY, 100000)
   DbeInfo(COMPONENT_DATA , DBFDBE_LOCKDELAY,     10)
   DbeInfo(COMPONENT_DATA,  DBFDBE_LIFETIME,      20)
   DbeInfo(COMPONENT_ORDER, NTXDBE_LOCKRETRY, 100000)
   DbeInfo(COMPONENT_ORDER, NTXDBE_LOCKDELAY,     10)
endif

if !DbeBuild('DbfCdx', 'dbfdbe', 'cdxdbe')          // 'DbfCdx' := DBF with CDX index
   Stop_('DBFCDX Database-Engine: could not build engine', .f.)
else
   DbeInfo(COMPONENT_DATA , DBFDBE_LOCKRETRY, 100000)
   DbeInfo(COMPONENT_DATA , DBFDBE_LOCKDELAY,     10)
   DbeInfo(COMPONENT_DATA,  DBFDBE_LIFETIME,      20)

   DbeInfo(COMPONENT_ORDER, CDXDBE_LOCKRETRY, 100000)
   DbeInfo(COMPONENT_ORDER, CDXDBE_LOCKDELAY,     10)
   DbeInfo(COMPONENT_ORDER, CDXDBE_MODE,  CDXDBE_VFOXPRO)   // If you opt for to use CDXDBE_VFOXPRO (see the docs)
                                                               // you must do Set Collation to ASCII before
                                                               // to create the indexes

   DbeInfo(COMPONENT_ORDER, DBE_LOCKMODE, LOCKING_EXTENDED)
endif

if !DbeBuild('FoxNtx', 'foxdbe', 'ntxdbe')
   Stop_('FOXNTX Database-Engine: could not build engine', .f.)
else
   DbeInfo(COMPONENT_DATA,  FOXDBE_LOCKRETRY, 100000)
   DbeInfo(COMPONENT_DATA,  FOXDBE_LOCKDELAY,     10)
   DbeInfo(COMPONENT_DATA,  FOXDBE_LIFETIME,      20)

   DbeInfo(COMPONENT_ORDER, NTXDBE_LOCKRETRY, 100000)
   DbeInfo(COMPONENT_ORDER, NTXDBE_LOCKDELAY,     10)
   DbeInfo(COMPONENT_ORDER, DBE_LOCKMODE, LOCKING_EXTENDED)
endif

if !DbeBuild('FoxCdx', 'foxdbe', 'cdxdbe' )        // 'FoxCdx' := Compatibility with FoxPro and CDX indexes
   Stop_('FOXCDX Database-Engine: could not build engine', .f.)
else
   DbeInfo(COMPONENT_DATA,  FOXDBE_LOCKRETRY, 100000)
   DbeInfo(COMPONENT_DATA,  FOXDBE_LOCKDELAY,     10)
   DbeInfo(COMPONENT_DATA,  FOXDBE_LIFETIME,      20)

   DbeInfo(COMPONENT_ORDER, CDXDBE_LOCKRETRY, 100000)
   DbeInfo(COMPONENT_ORDER, CDXDBE_LOCKDELAY,     10)
   DbeInfo(COMPONENT_ORDER, CDXDBE_MODE,  CDXDBE_VFOXPRO)   // If you opt for to use CDXDBE_VFOXPRO (see the docs)
                                                               // you must do Set Collation to ASCII before
                                                               // to create the indexes
   DbeInfo(COMPONENT_ORDER, DBE_LOCKMODE, LOCKING_EXTENDED)
endif
                  //
                  //       TExt format
DbeLoad('deldbe', .f.)                             // Delimited Files
DbeLoad('sdfdbe', .f.)                             // SDF Files
                  //
                  //    Set Default
DbeSetDefault('FoxCdx')
RETURN

STATIC FUNCTION stop_(cMens, lStop)
Alert(cMens)
if lStop == NIL .or.;
   lStop
   QUIT
endif
RETURN


