MDAC 2.5 SDK - OLE DB Programmer's Reference
Chapter 16: Errors
A custom error object can be associated with each error record. An interface pointer to the object is stored in the record. If no custom error object exists, this pointer is null. The custom error object is the mechanism by which OLE DB error objects are extensible.
When an error record is added, the error object calls AddRef to add a reference to the custom error object. The provider that created the custom error object calls Release to release its hold on the custom error object. In this way, ownership of the custom error object is effectively transferred from the provider to the error object. The error object releases all custom error objects when it is released.
For example, ODBC-related providers can expose ISQLErrorInfo on a custom error object to return the SQLSTATE value. For more information, see ISQLErrorInfo.