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:
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:
Perform corrective action based on the error condition.
For an example, refer to “Visual C++ Example” on page 73.