|
<< Click to Display Table of Contents >> Creating tables |
![]() ![]()
|
The application can create permanent tables by using the BDE function DbiCreateTable. It can also create temporary tables with DbiCreateTempTable and in-memory tables with DbiCreateInMemTable.
Permanent tables
Permanent tables are named and are saved to disk. To create a permanent table, the application first creates a field descriptor structure FLDDesc for each field in the table and an index descriptor structure IDXDesc for each index. For SQL and Paradox tables, the application can also define a descriptor structure for each validity check VCHKDesc. For Paradox and SQL tables, the application can define a descriptor structure for each referential integrity check RINTDesc, and each security check SECDesc to be enforced.
Next, the application creates a table descriptor structure CRTblDesc defining general attributes of the table, and supplying pointers to arrays of field, index, validity, referential integrity and security descriptor structures previously created. Finally, the application calls DbiCreateTable, passing the CRTblDesc structure.
Specifying optional parameters
When creating a Paradox, dBASE, FoxPro, or Access table, optional driver-specific parameters may be included in the last three fields of the CRTblDesc structure. To retrieve a list and description of these optional parameters for a driver, the application can call DbiOpenCfgInfoList, supplying the path of the driver's table create options in the configuration file. This function returns an in-memory table with information about relevant optional parameters, as well as the default values for these parameters. For example, the Table Level is an optional parameter for dBASE and Paradox tables.
Temporary tables
A temporary table is deleted when the cursor is closed. The application can create a temporary table in the same way it creates a permanent table except that it calls DbiCreateTempTable instead of DbiCreateTable. See "Permanent Tables" above for a description of the descriptor structures used to create a table.
For Paradox, dBASE, and FoxPro only, a temporary table can be made into a permanent table by calling DbiMakePermanent while the cursor is still open and supplying a table name, or calling DbiSaveChanges.
In-memory tables
An in-memory table cannot be saved as a permanent table. The application can create an in-memory table by calling DbiCreateInMemTable, and supplying an array of field descriptor structures FLDDesc. The table descriptor CRTblDesc is not used. Only BDE logical types are supported.