Function DbeBuild() Foundation

Assembles and loads a compound database engine (DBE) from loaded component DBEs.

Syntax
DbeBuild( <cCompoundDBE>  , ;
          <cDataDBE>      , ;
         [<cOrderDBE>]    , ;
         [<cRelationDBE>] , ;
         [<cDictionaryDBE>] ) --> lSuccess
Parameters
<cCompoundDBE>
<cCompoundDBE> is a character string containing the name for the newly assembled database engine (compound DBE). The new DBE is identified by this name.
<cDataDBE>
<cDataDBE> is a character string containing the name of a loaded DBE describing the data storage model for the database (the DATA component).
<cOrderDBE>
<cOrderDBE> is an optional character string containing the name of a loaded DBE describing the order model for a database (the ORDER component). The default value is NIL.
<cRelationDBE>
<cRelationDBE> is an optional character string containing the name of a loaded DBE describing the relation model for a database (the RELATION component). The default value is NIL.
<cDictionaryDBE>
<cDictionaryDBE> is an optional character string containing the name of a loaded DBE describing the database structure and/or integrity rules for a database (the DICTIONARY component). The default value is NIL.
Return

When a compound DBE was generated from the specified component DBEs, the function returns the value .T. (true). Otherwise, it returns .F. (false).

Description

The DBE function DbeBuild() generates a new, assembled database engine (compound DBE) from previously loaded DBEs (component DBEs). A compound DBE makes use of all the characteristics of the component DBEs. When DbeBuild() is successful, it also means that DbeSetDefault() has been called with the new DBE, meaning the newly formed DBE is the default used for file management. This is then used as the default for commands like USE (where the option VIA can be specified) and all functions which can optionally specify a database engine.

In Xbase++ database engines can be assembled from up to four different components to build a database model. These individual components are the DATA, ORDER, RELATION and DICTIONARY components. A component is represented by a database engine (component DBE) which is contained in a DLL file and must be loaded into main memory using the function DbeLoad() before calling the function DbeBuild(). The function DbeBuild() creates a compound DBE from the specified component DBEs.

The number of component DBEs required for the definition of a database model varies depending on the database model. For the Xbase database model as defined by Clipper, the DATA component (DBFDBE) and the ORDER component (NTXDBE) are sufficient. (See the chapter "The Xbase++ Database Engine"in the Xbase++ documentation).

In the file DBESYS.PRG the database engines DBFDBE and NTXDBE are loaded by default and assembled to the DBFNTX database engine. This compound DBE is used in Xbase++ as default DBE for data and database management.

Examples
Create the DBFCDX Database Engine

// In the example, a compound DBE is created from two 
// component DBEs suitable for managing records 
// and indexes in the DBFCDX database model. 

PROCEDURE DbeSys 

IF ! DbeLoad( "DBFDBE", .T.)      // load engine for DBF files 
   ALERT( "Database Engine DBFDBE not loaded" , {"OK"} ) 
ENDIF 

IF ! DbeLoad( "CDXDBE" , .T.)     // load engine for CDX files 
   ALERT( "Database Engine CDXDBE not loaded" , {"OK"} ) 
ENDIF 
                                  // assemble engines for data 
                                  // record and index management 
IF ! DbeBuild( "DBFCDX", "DBFDBE", "CDXDBE" ) 
   ALERT( "Database Engine DBFCDX not created" , {"OK"} ) 
ENDIF 

RETURN 
Create index for files in the SDF format

// In this example, a DBE is generated for files in the 
// SDF format. The SDFNTX DBE is generated with DbeBuild() 
// from the NTXDBE and the SDFDBE as components. 
// The program assumes that NTXDBE is loaded. 

PROCEDURE Main 
   LOCAL aStruct 

   IF ! DbeLoad( "SDFDBE", .T. )         // load SDFDBE "hidden" 
      ALERT( "SDFDBE not loaded" , {"OK"} ) 
   ENDIF 
                                         // create compound DBE 
   DbeBuild( "SDFNTX", "SDFDBE", "NTXDBE" ) 

   USE Address VIA Dbfntx                // open DBF file 
   COPY TO Address.txt SDF               // create SDF file 

   DbeSetDefault( "SDFNTX" ) 
   USE Address.txt                       // open SDF file 
                                         // (ASCII file) 
   INDEX ON Upper(LastName+FirstName) TO Address.ntx 
                                         // index ASCII file 
   Browse() 

   CLOSE Address 
RETURN 
Feedback

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.