|
<< Click to Display Table of Contents >> Getting and setting properties |
![]() ![]()
|
See also BDE objects / Object properties
Each Borland Database Engine (BDE) object is defined by a set of properties. The properties defining an object depend on the object's type. For example, a session is a BDE object, and its properties include sesMAXPROPS, sesSESSIONNAME, and sesCFGMODE2. Each type of object has its own set of properties, as listed in Object Properties.
Values are initially assigned to properties when an object is created. For example, the name of the table is assigned to the curTABLENAME property of the cursor object when the table is opened with DbiOpenTable.
Values of some properties can be changed with the BDE function DbiSetProp. To reset a property, the application passes the object handle, the name of the property to be changed, and the new value of the property.
To retrieve an object's current property settings, use DbiGetProp.
To retrieve an object's handle, use DbiGetObjFromName.
To retrieve a cursor's database handle, use DbiGetObjFromObj.
This example illustrates a method for getting the table name/type when all that is available is the table cursor:
UINT16 iLen;
DBITBLNAME tblName;
DBINAME tblType, dbName;
// The table cursor gives you access to the table
// name and the table type.
DbiGetProp(hCursor, curTABLENAME, (pVOID) tblName, sizeof(tblName), &iLen);
DbiGetProp(hCursor, curTABLETYPE, (pVOID) tblType, sizeof(tblType), &iLen);
// You can also access database properties (such as
// the name of the database associated with the cursor).
DbiGetProp(hCursor, dbDATABASENAME, (pVOID) dbName, sizeof(dbName), &iLen);