16.18 Attributes that can be specified in DiagIdentifier of SQLGetDiagField and SQLGetDiagFieldW
The following table lists and describes the attributes that can be specified for DiagIdentifier.
No. |
Diagnostic field identifier (DiagIdentifier) |
Description (convention) |
Return value |
Data type |
---|---|---|---|---|
1 |
SQL_DIAG_CURSOR_ROW_COUNT |
Returns the row count in the cursor. This applies only to statement handles. If any other handle is specified, SQL_ERROR is returned. |
Always returns 0. |
SQLLEN |
2 |
SQL_DIAG_DYNAMIC_FUNCTION |
Returns the SQL statement executed by the function. This applies only to statement handles. If any other handle is specified, SQL_ERROR is returned. You can acquire this value immediately after SQLExecute, SQLExecDirect, or SQLExecDirectW. |
Returns the following values:
The function always returns "" unless it is executed immediately after SQLExecute, SQLExecDirect, or SQLExecDirectW. |
|
3 |
SQL_DIAG_DYNAMIC_FUNCTION_CODE |
Returns a value indicating the SQL statement executed by the function. This applies only to statement handles. If any other handle is specified, SQL_ERROR is returned. You can acquire this value immediately after SQLExecute, SQLExecDirect, or SQLExecDirectW. |
Returns the following values:
The function always returns SQL_DIAG_UNKNOWN_STATEMENT unless it is executed immediately after SQLExecute, SQLExecDirect, or SQLExecDirectW. |
SQLINTEGER |
4 |
SQL_DIAG_NUMBER |
Returns the number of available status records. |
Returns 0 or 1. |
SQLINTEGER |
5 |
SQL_DIAG_RETURNCODE |
Returns the return code returned by the ODBC function that was executed immediately before SQLGetDiagField, SQLGetDiagFieldW, SQLGetDiagRec, or SQLGetDiagRecW. |
Always returns SQL_SUCCESS. |
SQLRETURN |
6 |
SQL_DIAG_ROW_COUNT |
Returns the number of rows affected by insert, delete, or update processing. This applies only to statement handles. If any other handle is specified, SQL_ERROR is returned. |
Always returns 0. |
SQLLEN |
No. |
Diagnostic field identifier (DiagIdentifier) |
Description (convention) |
Return value |
Data type |
---|---|---|---|---|
1 |
SQL_DIAG_CLASS_ORIGIN |
Returns a character string indicating the document that defines the class portion of SQLSTATE. |
Returns the following values:
|
|
2 |
SQL_DIAG_COLUMN_NUMBER |
Returns a value indicating a column number in the result set or a parameter number in the parameter set. This applies only to statement handles. |
Always returns 0. |
SQLINTEGER |
3 |
SQL_DIAG_CONNECTION_NAME |
Returns the name of the connection. |
Always returns "". |
|
4 |
SQL_DIAG_MESSAGE_TEXT |
Returns a message about an error or warning. |
A character string beginning with "[Hitachi Advanced Data Binder ODBC Driver]..." is returned. Some information might be added. |
|
5 |
SQL_DIAG_NATIVE |
Returns an ODBC driver-specific or data source-specific native error code. If there is no such error code, 0 is returned. |
Returns 0 or the value of SQLCODE. For details about SQLCODE, see Interpreting SQLCODEs in the manual HADB Messages. |
SQLINTEGER |
6 |
SQL_DIAG_ROW_NUMBER |
Returns a value indicating the column number in the row set or the parameter number in the parameter set. This applies only to statement handles. |
Always returns 0. |
SQLLEN |
7 |
SQL_DIAG_SERVER_NAME |
Returns the server name. |
Always returns "". |
|
8 |
SQL_DIAG_SQLSTATE |
Returns an SQLSTATE diagnostic code consisting of 5 characters. |
Returns a 5-character SQLSTATE diagnostic code stipulated by the ODBC conventions. |
|
9 |
SQL_DIAG_SUBCLASS_ORIGIN |
Returns a character string that contains a valid value in the same format as for SQL_DIAG_CLASS_ORIGIN. This value identifies the definition of the subclass portion of SQLSTATE. |
Returns the following values:
|
|