SQLGetDiagField
SQLGetDiagField#
SQLGetDiagField is Used to diagnose the result after an Altibase CLI function is used.
SQLGetDiagFieldW() as a Unicode string supports same execution as SQLGetDiagField().
Syntax#
SQLRETURN SQLGetDiagField(SQLSMALLINT HandleType,
SQLHANDLE Handle,
SQLSMALLINT RecNumber,
SQLSMALLINT DiagIdentifier,
SQLPOINTER DiagInfoPtr,
SQLSMALLINT BufferLength,
SQLSMALLINT *StringLengthPtr)
Arugments#
Data Type | Argument | In/Output | Description |
---|---|---|---|
SQLSMALLINT | HandleType | Input | A handle type to be assigned. It can be any of the followings: - SQL_HANDLE_ENV - SQL_HANDLE_DBC - SQL_HANDLE_STMT |
SQLHANDLE | Handle | Input | - If input HandleType is SQL_HANDLE_ENV, InputHandle should be SQL_NULL_HANDLE. - If SQL_HANDLE_DBC, it should be an environment handle. - If SQL_HANDLE_STMT, it should be a connection handle. |
SQLSMALLINT | DiagIdentifier | Input | A type to be diagnosed. For now, SQL_DIAG_NUMBER is only supported. |
SQLPOINTER | DiagInfoPtr | Output | A pointer to the buffer to which diagnostic information is returned. |
SQLINTEGER | BufferLength | Input | - If *DiagInfoPtr is the pointer of character string, this has the byte length of string or the value of SQL_NTS. - If *DiagInfoPtr is the pointer of binary buffer, this has the binary length of data. - If *DiagInfoPtr is the pointer with fixed-length data type, its value is ignored. |
SQLINTEGER* | StringLengthPtr | Output | This returns bytes available to return in *ValuePtr((excluding the null-termination character)). |
Result Value#
An error message for each handle type.
Description#
This function is used to diagnose the execution result for an error. It is used in the following case:
In Altibase CLI functions, when SQL_ERROR or SQL_SUCCESS_WITH_INFO is returned, error and warning information is gathered. This function is used to determine the gathered information.
Any Altibase CLI function can call this function for diagnosis after its execution. This function shows the most recently stored diagnosis information.
Currently, it works for the following handle types:
SQL_HANDLE_ENV
SQL_HANDLE_DBC
SQL_HANDLE_STMT
For an input Argument, if HandleType is SQL_HANDLE_ENV, InputHandle should be SQL_NULL_HANDLE, or if SQL_HANDLE_DBC, it should be an environment handle, or if SQL_HANDLE_STMT, it should be a connection handle. That is, a value should be set properly for each input handle.
Related Function#
SQLError