The following table describes which interfaces providers must implement to support OLE DB error objects, which interfaces are implemented by code in the OLE DB SDK, and which functions are implemented by the Automation DLL.
Interfaces required of providers to support OLE DB error objects
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:OLE DB Implemented by:Provider Implemented on:Error lookup service The error lookup service is required by the error object code in the OLE DB SDK and is used by that code to implement IErrorRecords and IErrorInfo. For more information, see "Error Lookup Services" later in this chapter. |
IErrorRecords | Defined by:OLE DB Implemented by:OLE DB SDK Implemented on:OLE DB error object This is the main interface through which OLE DB error objects are accessed. |
IErrorInfo | Defined by:Automation Implemented by:OLE DB SDK Implemented on:OLE DB error object OLE DB error objects expose IErrorInfo at the top level (that is, on the object itself) only so 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 other records, the consumer calls IErrorRecords::GetErrorInfo and passes a 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 using the specified locale ID. The IErrorInfo pointer returned on a particular record is not the same as the IErrorInfo interface pointer exposed by the OLE DB error object through QueryInterface. For more information about how these interface pointers are used, see "How a Consumer Retrieves an OLE DB Error Object" and "Error Lookup Services" later in this chapter. |
IClassFactory | Defined by:Automation Implemented by:OLE DB 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 OLE DB 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 with 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 DLL 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 DLL 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. |