Retrieving the Error - OLE DB Provider for Teradata

OLE DB Provider for Teradata User Guide

Product
OLE DB Provider for Teradata
Release Number
15.00
Language
English (United States)
Last Update
2018-09-28
dita:id
B035-2498
Product Category
Teradata Tools and Utilities

Retrieving the Error

To retrieving an error

A consumer can retrieve information about errors generated by Teradata Database or the provider by performing these steps:

1 Call the automation method GetError. This returns an interface to IErrorInfo.

2 Use the interface to IErrorInfo to query the IErrorRecords Interface.

3 Loop through the records returned from IErrorRecords and make calls to the following methods:

  • IErrorRecords::GetCustomErrorObjects. See step 4 and step 5.
  • IErrorRecords::GetBasicInfo. See step 6.
  • 4 The call to IErrorRecords::GetCustomErrorObjects uses IID_ISQLErrorInfo as the REFIID to return an interface to ISQLErrorInfo.

     

    IF...

    THEN...

    an SQLState returns,

    the error originated from Teradata Database.

    no SQLState returns,

    the error originated from OLE DB Provider for Teradata.

    5 Use the interface to the ISQLErrorInfo interface to retrieve the SQLState and Native Error Code.

    6 The call to IErrorRecords::GetBasicInfo returns basic information about the error:

  • Return code
  • Provider-specific error number
  • Perform corrective action based on the error condition.

    For an example, refer to “Visual C++ Example” on page 73.