Interfaces Used by OLE DB Error Objects

The following table describes which interfaces providers must implement to support OLE DB error objects, which interfaces are implemented in the data access SDK, and which functions are implemented by the OLE DB error object.

Interface or function

Comments

ISupportErrorInfo

Defined by:Automation
Implemented by: Provider
Implemented on: OLE DB object (for example, rowset or command)

The consumer uses this interface to determine whether an object can return OLE DB error objects and, if so, which interfaces on that object can return OLE DB error objects.

IErrorLookup

Defined by:Automation
Implemented by:Provider
Implemented on:Error lookup service

The error lookup service is required by the OLE DB error object and is used by that code to implement IErrorRecords and IErrorInfo. For more information, see Error Lookup Services.

IErrorInfo

Defined by:Automation
Implemented by:SDK
Implemented on:OLE DB error object

OLE DB error objects expose IErrorInfo so that they can be treated by the Automation DLL and by Automation consumers as Automation error objects. If the methods on this interface are called, they will retrieve the information from record 0 using the default locale ID.

To retrieve error information from a record, the consumer can call IErrorRecords::GetErrorInfo and pass the record number and locale ID. The OLE DB error object returns a pointer to an IErrorInfo interface, which will return error information from the specified error record by using the specified locale ID.

IErrorRecords

Defined by:OLE DB
Implemented by: SDK
Implemented on:OLE DB error object

This is the main interface through which OLE DB error objects are accessed.

IClassFactory

Defined by:Automation
Implemented by:SDK
Implemented on:OLE DB error object class factory

OLE DB error objects are created by a class factory exposed by the error object code in the SDK. You can create them by calling CoCreateInstance with the CLSID_EXTENDEDERRORINFO class ID or by calling IClassFactory::CreateInstance on a class factory object retrieved by using DllGetClassObject. If the provider frequently creates error objects, the latter method is faster and therefore preferred.

OLE DB error objects cannot be created by the CreateErrorInfo function in the Automation DLL because the function can create only Automation error objects.

GetErrorInfo

Defined by:Automation
Implemented by:Automation
Implemented on:N/A

GetErrorInfo transfers ownership of the OLE DB error object on the current thread from the Automation DLL to the consumer. It identifies error objects by their IErrorInfo interface pointer, which is one reason OLE DB error objects directly expose IErrorInfo.

SetErrorInfo

Defined by:Automation
Implemented by:Automation
Implemented on:N/A

SetErrorInfo transfers ownership of the OLE DB error object on the current thread from the provider to the Automation DLL. It identifies error objects by their IErrorInfo interface pointer, which is one reason OLE DB error objects directly expose IErrorInfo.