From RAD Studio API Documentation
Jump to: navigation, search



TDBError = class


class PASCALIMPLEMENTATION TDBError : public System::TObject


Type Visibility Source Unit Parent
class public
Bde.DBTables Bde.DBTables


TDBError represents Borland Database Engine errors for the EDBEngineError exception class.

The TDBError object is a container for the information pertaining to one database error. One or more TDBError objects are contained in the Errors property (EDBEngineError).

An EDBEngineError exception is raised when Borland Database Engine (BDE) or a database back-end accessed via the BDE produces an error condition on execution of a database operation. Information about each error involved in an error condition (such as an error code and error message) is passed by the BDE to the EDBEngineError object. If the error occurs at the level of a database system accessed by the BDE (such as InterBase, Oracle, or Sybase), the error information is passed through the BDE to the application's exception object. EDBEngineError reads the stack of database engine errors and creates a separate TDBError object to represent each one. These TDBError objects are contained in the Errors property of EDBEngineError.

When an error condition originates with a database system accessed through the BDE, there will typically be two TDBError objects in Errors. The first will be the BDE version of the error and the second the database system's version of the same error. In both cases, the Category, ErrorCode, and SubCode properties will contain the same values: the BDE error code for the particular type of error condition. In the TDBError object for the BDE's version of the error the NativeCode property is empty and the text for the Message property contains the BDE error message the type type of error that occurred. In the TDBError object for the database system's version of the error, the NativeCode property contains the database systems specific error code and the Message property text provided by the database system (and not the BDE).

For example, when a violation of an InterBase CHECK constraint occurs (an error condition that originates with InterBase and not the BDE), the error message provided by the BDE is the generic "General SQL error," while the error message provided by InterBase is a more explanatory error like "Operation violates CHECK constraint INTEG_30 on view or table EMPLOYEE."

It is also possible to have only BDE type errors in the TDBError objects. This is usually only applicable to use of local table types (dBASE, Paradox, and FoxPro), where the BDE is the database back-end and there is no external database system used.

The categories and subcodes for BDE errors are defined in (Delphi) or bde.hpp (C++). For error information provided by a database system other than the BDE, consult the vendor-supplied documentation for the specific database system for definition or clarification.

See Also