Hitachi

Hitachi Advanced Database Application Development Guide


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.

Table 16‒24: Attributes that can be specified for DiagIdentifier (for header fields)

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:

  • "ALTER TABLE"

  • "ALTER USER"

  • "ALTER VIEW"

  • "CREATE AUDIT"

  • "CREATE INDEX"

  • "CREATE SCHEMA"

  • "CREATE TABLE"

  • "CREATE USER"

  • "CREATE VIEW"

  • "DELETE"

  • "DROP AUDIT"

  • "DROP INDEX"

  • "DROP SCHEMA"

  • "DROP TABLE"

  • "DROP USER"

  • "DROP VIEW"

  • "GRANT"

  • "INSERT"

  • "PURGE CHUNK"

  • "REVOKE"

  • "SELECT CURSOR"

  • "TRUNCATE TABLE"

  • "UPDATE"

  • ""

The function always returns "" unless it is executed immediately after SQLExecute, SQLExecDirect, or SQLExecDirectW.

  • SQLCHAR *

  • SQLWCHAR *

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:

  • SQL_DIAG_INSERT

  • SQL_DIAG_CREATE_TABLE

  • SQL_DIAG_ALTER_TABLE

  • SQL_DIAG_DROP_TABLE

  • SQL_DIAG_CREATE_INDEX

  • SQL_DIAG_DROP_INDEX

  • SQL_DIAG_CREATE_SCHEMA

  • SQL_DIAG_DROP_SCHEMA

  • SQL_DIAG_CREATE_VIEW

  • SQL_DIAG_DROP_VIEW

  • SQL_DIAG_UNKNOWN_STATEMENT

  • SQL_DIAG_SELECT_CURSOR

  • SQL_DIAG_UPDATE_WHERE

  • SQL_DIAG_DELETE_WHERE

  • SQL_DIAG_GRANT

  • SQL_DIAG_REVOKE

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

Table 16‒25: Attributes that can be specified for DiagIdentifier (for record fields)

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:

  • "ODBC 3.0"

  • "ISO 9075"

  • SQLCHAR *

  • SQLWCHAR *

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 "".

  • SQLCHAR *

  • SQLWCHAR *

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.

  • SQLCHAR *

  • SQLWCHAR *

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 "".

  • SQLCHAR *

  • SQLWCHAR *

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.

  • SQLCHAR *

  • SQLWCHAR *

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:

  • "ODBC 3.0"

  • "ISO 9075"

  • SQLCHAR *

  • SQLWCHAR *