Additional Diagnostic Fields for SQLGetDiagField() API in ODBC Driver

ASE ODBC Driver specifies the following additional vendor specific diagnostic fields for SQLGetDiagField() API.

These fields are available in all diagnostic records generated on ODBC statement handle. These are also available on connection handle if the application is linked directly with the ASE ODBC Driver.

The additional vendor specific fields are defined in sybasesqltypes.h header file and are:

Fields

Description

SQL_DIAG_ASE_LINE_NUMBER

Reports the line number of stored procedure generating an error. The value is returned as an unsigned, 16-bit integer.

SQL_DIAG_ASE_MESSAGE_STATE

Reports Message State field from error token that ASE Server returns. The value is returned as a signed, 32-bit integer.

SQL_DIAG_ASE_STORED_PROCEDURE_NAME

Reports the stored procedure name generating an error, if appropriate. The value is returned as a null terminated character string. Allocate enough buffer to get the procedure name; otherwise, driver truncates the string to fit in the allocated buffer. If you pass DiagInfoPtr as NULL and valid StringLenghtPtr then SQLGetDiagField() API returns the length of procedure name string in buffer that StringLengthPtr points to.

SQL_DIAG_ASE_MESSAGE_SEVERITY

Reports the severity level(message class) associated with the error message. This value is returned as a signed, 32-bit integer.

SQL_DIAG_ASE_SERVER_NAME

Reports the name of the server on which error occurred. The value is returned as a null terminated character string. Allocate enough buffer to get the server name otherwise driver truncates the string to fit in the allocated buffer. If you pass DiagInfoPtr as NULL and valid StringLengthPtr then SQLGetDiagField() API returns the length of the server name string in buffer that StringLengthPtr points to.