|
<< Click to Display Table of Contents >> DbiGetErrorContext |
![]() ![]()
|
C syntax
DBIResult DBIFN DbiGetErrorContext (eContext, pszContext);
Delphi syntax
function DbiGetErrorContext (eContext: SmallInt; pszContext: PChar): DBIResult stdcall;
Description
After receiving an error code back from a call, DbiGetErrorContext allows the client to probe BDE for more specific error information.
Parameters
eContext Type: INT16 (Input)
Specifies the context type.
pszContext Type: pCHAR (Output)
Pointer to the client-allocated buffer that receives the context string. The buffer must be at least as large as (DBIMAXMSGLEN+1).
Usage
DbiGetErrorContext allows the client to receive more information about the error just received, such as which table failed to open. The client inputs the error context type and the function returns a character string.
For example, a client tries to open a nonexistent table using DbiOpenTable, and receives a return of DBIERR_NOSUCHFILE. The error context is logged by the BDE. Other error contexts can be logged as well, so rather than force the user to scan each error context individually, the BDE provides a way to search for a particular context type. In this example, the user wants to know the table name associated with the error condition, and 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.
| Note: | If all that is required is a formatted error message for the end user, |
DbiGetErrorInfo is a more convenient way to get it.
Prerequisites
Calls other than error handling functions may be made after the call that produced the error, but the current context information is lost. If DbiOpenTable fails, no functions that require a cursor can be called because none was returned. But other functions and another DbiOpenTable can be called.
DbiResult |
Meaning |
DBIERR_NONE |
The error context was successfully returned. |
See also