Using DbiGetErrorContext to get more specific information

<< Click to Display Table of Contents >>

Navigation:  Application development > Error handling >

Using DbiGetErrorContext to get more specific information

Previous pageReturn to chapter overviewNext page

DbiGetErrorContext returns more specific error information about the context of an error, such as the name of the offending table or field. When an error occurs, the error context is logged by the BDE engine. Other error contexts can be logged as well, so rather than force the user to scan each error context individually, DbiGetErrorContext searches for a particular context type. The application inputs the error context type and the function returns a character string.

Error Context Types

Error contexts can be one of the following types:

Type

Description

ecTOKEN

Token (For QBE)

ecTABLENAME

Table name

ecFIELDNAME

Field name

ecIMAGEROW

Image row (For QBE)

ecUSERNAME

For example, in lock conflicts, user involved

ecFILENAME

File name

ecINDEXNAME

Index name

ecDIRNAME

Directory name

ecKEYNAME

Key name

ecALIAS

Alias

ecDRIVENAME

Drive name ('c:')

ecNATIVECODE

Native error code

ecNATIVEMSG

Native error message

ecLINENUMBER

Line number

ecCAPABILITY

Capability

For example, if the application attempts to open a nonexistent table by using DbiOpenTable, it receives an error code of DBIERR_NOSUCHFILE. To determine which table name is associated with the error condition, the application calls DbiGetErrorContext (ecTABLENAME, buffer), which returns the full path name of the table. If there is no table name associated with the error, the buffer is empty.