Core subroutine
Return error or status information.
call EDSError(HENV_IV, HDBC_IV, HSTMT_IV, SQLSTATE_SV, NATIVEERROR_IV, ERRORTEXT_SV )
•HENV_IV An input integer value indicating the environment handle or EDS_NULL_HENV.
•HDBC_IV An input integer value indicating the connection handle or EDS_NULL_HDBC.
•HSTMT_IV An input integer value indicating the statement handle or EDS_NULL_HSTMT.
•SQLSTATE_SV An output string value containing the error class and subclass as null-terminated string (SQLSTATE). See EDS ODBC Error Codes, for a list of classes and subclasses.
•NATIVEERROR_IV An output integer value indicating the native error code (specific to the data source).
•ERRORTEXT_SV An output string value containing the text of the message.
Description
Your application would typically call EDSError when a previous call to an EDS function returns EDS_ERROR or EDS_SUCCESS_WITH_INFO. However, you can call EDSError after any EDS function call.
Return Values
EDSError returns EDS_SUCCESS, EDS_SUCCESS_WITH_INFO, EDS_NO_DATA_FOUND, EDS_INVALID_HANDLE, or EDS_ERROR.
EDSError does not post error values for itself. If EDSError is unable to retrieve any error information, it typically returns EDS_NO_DATA_FOUND (in which case SQLSTATE equals 00000). If EDSError cannot access error values for any reason that would normally return EDS_ERROR, EDSError returns EDS_ERROR but does not post any error values. If the buffer for the error message is too short, EDSError returns EDS_SUCCESS_WITH_INFO but, again, does not return a SQLSTATE value for EDSError.
The driver stores error information in the HENV_IV, HDBC_IV, and HSTMT_IV variables and returns this information to your application when it calls EDSError. An EDS function can post zero or more errors.
Errors stored for a given handle are cleared only when the handle is used in a subsequent function call. For example, errors on a statement handle for a given call are cleared when another call is made using the statement handle. The errors stored on a given handle are never cleared as the result of a call on a function using a different type, but related handle. For example, errors on a connection handle are not cleared when a call is made to a related statement handle.
EDSError retrieves an error from the data structure associated with the rightmost non-null handle argument. Request error information as follows:
•To retrieve errors associated with an environment, your application must pass the corresponding environment handle and include EDS_NULL_HDBC and EDS_NULL_HSTMT in the connection handle and statement handle, respectively. The driver returns the error status of the EDS function most recently called with the same environment handle.
•To retrieve errors associated with a connection, your application must pass the corresponding connection handle plus a statement handle equal to EDS_NULL_HSTMT. In such a case, the driver ignores the HENV_IV argument. The driver returns the error status of the EDS function most recently called with the connection handle.
•To retrieve errors associated with a statement, your application must pass the corresponding statement handle. If the call to EDSError contains a valid statement handle, the driver ignores the HDBC_IV and HENV_IV arguments. The driver returns the error status of the EDS function most recently called with the statement handle.
•To retrieve multiple errors for a call, your application can call EDSError multiple times. For each error, the driver returns EDS_SUCCESS and removes that error from the list of available errors.
When there is no additional information for the rightmost non-null handle, EDSError returns EDS_NO_DATA_FOUND. In this case, SQLSTATE equals 00000, NATIVEERROR is undefined, and ERRORTEXT contains a null string.
See Also