|
<< Click to Display Table of Contents >> CRTblDesc (table descriptor) |
![]() ![]()
|
DbiDoRestructure and DbiCreateTable both use the CRTblDesc structure, but the way they use the structure is quite different. Some of the fields within CRTblDesc are not specified at create time for use with DbiCreateTable; they are specified only with DbiDoRestructure to modify the table.
CRTblDesc for creating a table
The CRTblDesc structure defines the general attributes of the table and supplies pointers to arrays of field, index, and other descriptors. The following CRTblDesc structure defines the table structure:
Field |
Type |
Description |
szTblName |
DBITBLNAME |
Specifies the table name, including optional path and extension. |
szTblType |
DBINAME |
Specifies the driver type. |
szErrTblName |
DBIPATH |
Reserved. |
szUserName |
DBINAME |
Reserved. |
szPassword |
DBINAME |
Specifies the master password (if bProtected is TRUE). (Paradox only.) |
bProtected |
BOOL |
TRUE if encryption is desired (Paradox only). |
iFldCount |
UINT16 |
Specifies the number of field definitions supplied. |
pfldDesc |
pFLDDesc |
Specifies the array of field descriptors. |
iIdxCount |
UINT16 |
Specifies the number of index definitions supplied. |
pidxDesc |
pIDXDesc |
Specifies the array of index descriptors. |
iSecRecCount |
UINT16 |
Specifies the number of security definitions given (Paradox only). |
psecDesc |
pSECDesc |
Specifies the array of security descriptors |
iValChkCount |
UINT16 |
Specifies the number of validity checks |
pvchkDesc |
pVCHKDesc |
Specifies the array of validity check descriptors (Paradox and SQL only). |
iRintCount |
UINT16 |
Specifies the number of referential integrity specifications (Paradox and SQL only). |
printDesc |
pRINTDesc |
Specifies the array of referential integrity specifications (Paradox, dBASE and SQL only). |
iOptParams |
UINT16 |
Specifies the number of optional parameters. |
pfldOptParams |
pFLDDesc |
Specifies the array of field descriptors for optional parameters. |
pOptData |
pBYTE |
Specifies the values of optional parameters. |
CRTblDesc for restructuring a table
A complete description of CRTblDesc, as used to restructure a table is described below.
Type |
Name |
Description |
|
DBITBLNAME |
szTblName |
Required; specifies the source table name. The table name can contain an extension. |
|
DBINAME |
szTblType |
If specified, it must match the driver type associated with the source table. |
|
DBIPATH |
szErrTblName |
Not currently used. |
|
DBINAME |
szUserName |
Not currently used. |
|
DBINAME |
szPassword |
Optional; if bProtected is set to TRUE, specifies the password of the destination table. |
|
BOOL |
bProtected |
Optional; If TRUE, specifies that a master password is supplied for the destination table. Paradox only. |
|
BOOL |
bPack |
Optional; If TRUE, specifies packing for restructure. |
|
(iFldCount, pecrFldOp, and pfldDesc are required to describe the new record structure) |
|||
UINT16 |
iFldCount |
Optional; used if the record structure is changing. Specifies the number of field operators and field descriptors passed in pecrFldOp and pFldDesc for the new record structure. |
|
pCROpType |
pecrFldOp* |
Optional; pointer to an array of CROpType structures, one for each field in the record; used if the record structure is changing, it indicates how the fields are rearranged. For each changed field, set it to crADD if the field is added, crMODIFY if the field is modified, or crCOPY if the field is moved. |
|
pFLDDesc |
pfldDesc |
Optional; used if the record structure is changing. Specifies an array of physical field descriptors for the new record structure. ifldNum in each pfldDesc must be 0 if the field is added. Otherwise, it must contain the field position (1 to n) in the old record structures. If a field is dropped, its descriptor is simply left out of the new record structure. Additionally, any changes to dependent objects are made automatically (that is, all single field indexes, validity checks, and auxiliary passwords are dropped). |
|
(For all the following objects, only the changes must be input.) |
|||
UINT16 |
IdxCount |
Optional; specifies the number of index operators and index descriptors passed in pIdxDesc. |
|
pCROpType |
pecrIdxOp |
Optional; to change an index, specify crADD, crMODIFY, crREDO, or crDROP. |
|
pIDXDesc |
pidxDesc |
Optional; specifies an array of index descriptors. |
|
UINT16 |
iSecRecCount |
Optional; for Paradox only; specifies the number of security definitions passed in psecDesc. |
|
pCROpType |
pecrSecOp |
Optional; to change a security definition, specify crADD, crMODIFY, or crDROP. |
|
pSECDesc |
psecDesc |
Optional; for Paradox only; specifies an array of security descriptors. |
|
UINT16 |
iValChkCount |
Optional; for Paradox only; specifies the number of validity checks passed in pecrValChkOp and pvchkDesc. |
|
pCROpType |
pecrValChkOp |
Optional; for Paradox only; to change a validity check, specify crADD, crMODIFY, or crDROP. |
|
pVCHKDesc |
pvchkDesc |
Optional; for Paradox only; specifies an array of validity check descriptors. |
|
UINT16 |
iRintCount |
Optional; for Paradox only; specifies the number of referential integrity operators passed in printDesc. |
|
pCROpType |
pecrRintOp |
Optional; for Paradox only; to change a referential integrity operator, specify crADD, crMODIFY, or crDROP. crMODIFY cannot be used to change the name of a referential integrity constraint. To modify the name, use crDROP and crADD. |
|
pRINTDesc |
printDesc |
Optional; for Paradox only; specifies an array of referential integrity specifications. |
|
UINT16 |
iOptParams |
Optional; specifies the number of optional parameters (for example, language driver information). |
|
pFLDDesc |
pfldOptParams |
Optional; specifies an array of field descriptors for optional parameters. |
|
pBYTE |
pOptData |
Optional; specifies values of optional parameters. |
|
Operands for table restructure
The following operation types are valid only for restructuring the table:
Operation type |
Value |
Description |
crNOOP |
0 |
Perform no operation |
crADD |
1 |
Add a new element |
crCOPY |
2 |
Copy an existing element |
crMODIFY |
3 |
Modify an element |
crDROP |
4 |
Removes an element |