Syntax
define external counter function SQLGetDiagRec
( value counter HandleType,
read-only SQL_handle_type Handle,
value counter RecNumber,
modifiable stream SQLstate,
modifiable counter NativeError,
modifiable stream MessageText,
value counter BufferLength,
modifiable counter TextLength )
Purpose
Returns the current values of multiple fields of a diagnostic record that contains error, warning, and status information. Unlike SQLGetDiagField , which returns one diagnostic field per call, SQLGetDiagRec returns several commonly used fields of a diagnostic record, including the SQLSTATE, the native error code, and the diagnostic message text.
Input arguments:
- HandleType. A handle type identifier that describes the type of handle for which diagnostics are required. The following values are allowed:
- SQL_HANDLE_ENV
- SQL_HANDLE_DBC
- SQL_HANDLE_STMT
- SQL_HANDLE_DESC
- Handle. A handle for the diagnostic data structure, of the type indicated by HandleType. If the handle type is SQL_HANDLE_ENV, the handle can be either a shared or an unshared environment handle.
- RecNumber. Indicates the status record from which the application seeks information. Status records are numbered from one (1).
- BufferLength. The length of MessageText. There is no maximum length for the diagnostic message.
Output arguments:
- SQLstate. The five-character SQL state code pertaining to the diagnostic record, RecNumber. The first two characters indicate the class; the next three indicate the subclass. This information is contained in the SQL_DIAG_SQLSTATE diagnostic field.
- NativeError. The native error code, specific to the data source. This information is located in the SQL_DIAG_NATIVE diagnostic field.
- MessageText. The diagnostic message. This information is contained in the SQL_DIAG_MESSAGE_TEXT diagnostic field.
- TextLength. The returned length of MessageText.
|