Help Center

CODBC.GetDiagFieldmethod

Returns the current value of a field of a record of the diagnostic data structure (associated with an environment handle) that contains error, warning, and status information.

DatabasesmethodCODBCDbc.incdocumented

Syntax

FUNCTION GetDiagField (BYVAL RecNumber AS SQLSMALLINT, BYVAL DiagIdentifier AS SQLSMALLINT, BYVAL DiagInfoPtr AS SQLPOINTER, BYVAL BufferLength AS SQLSMALLINT, BYVAL StringLength AS SQLSMALLINT PTR) AS SQLRETURN

Parameters

NameDescription
RecNumberIndicates the status record from which the application seeks information. Status records are numbered from 1. If the DiagIdentifier argument indicates any field of the diagnostics header, RecNumber is ignored. If not, it should be greater than 0.
DiagIdentifierIndicates the field of the diagnostic whose value is to be returned.
DiagInfoPtrPointer to a buffer in which to return the diagnostic information. The data type depends on the value of DiagIdentifier.
BufferLengthIf DiagIdentifier is an ODBC-defined diagnostic and DiagInfoPtr points to a character string or a binary buffer, this argument should be the length of DiagInfoPtr. If DiagIdentifier is an ODBC-defined field and DiagInfoPtr is an integer, BufferLength is ignored.
If DiagIdentifier is a driver-defined field, the application indicates the nature of the field to the Driver Manager by setting the BufferLength argument. BufferLength can have the following values:
If DiagInfoPtr is a pointer to a character string, then BufferLength is the length of the string or SQL_NTS.
If DiagInfoPtr is a pointer to a binary buffer, then the application places the result of the SQL_LEN_BINARY_ATTR(length) macro in BufferLength. This places a negative value in BufferLength.
If DiagInfoPtr is a pointer to a value other than a character string or binary string, then BufferLength should have the value SQL_IS_POINTER.
If DiagInfoPtr is contains a fixed-length data type, then BufferLength is SQL_IS_INTEGER, SQL_IS_UINTEGER, SQL_IS_SMALLINT, or SQL_IS_USMALLINT, as appropriate.
StringLengthPointer to a buffer in which to return the total number of bytes (excluding the number of bytes required for the null-termination character) available to return in DiagInfoPtr, for character data. If the number of bytes available to return is greater than or equal to BufferLength, the text in DiagInfoPtr is truncated to BufferLength minus the length of a null-termination character.

Return value

SQL_SUCCESS, SQL_SUCCESS_WITH_INFO, SQL_ERROR, SQL_INVALID_HANDLE, or SQL_NO_DATA.

Description

Returns the current value of a field of a record of the diagnostic data structure (associated with an environment handle) that contains error, warning, and status information.

Reference

  • Include file CODBCDbc.inc
  • Defined in AfxNova/COdbcDbc.inc:110
  • Documented in Databases/ODBC Classes/CODBC Class.md
  • Topic: ODBC Classes