Hitachi

Hitachi Advanced Database Application Development Guide


19.2.3 a_rdb_SQLSetConnectAttr() (set connection attributes)

Organization of this subsection

(1) Function

This CLI function sets the connection attributes of a specified connection handle.

(2) Format

signed short a_rdb_SQLSetConnectAttr
(
  void                          *ConnectionHandle,    /* In */
  signed short                   Attribute,           /* In */
  void                          *Value,               /* In */
  void                          *Option               /* In */
)

(3) Arguments

ConnectionHandle

Specifies a connection handle.

Attribute

Specifies one of the following connection attributes:

  • When the transaction isolation level is set:

    a_rdb_SQL_ATTR_TXN_ISOLATION

  • When a sort order is set for character string data in a SELECT statement in which the ORDER BY clause is specified:

    a_rdb_SQL_ATTR_ORDER_MODE

  • When the transaction access mode is set:

    a_rdb_SQL_ATTR_ACCESS_MODE

Value

Specifies the address at which the attribute information is stored.

• When the transaction isolation level is set

To set the transaction isolation level, specify the address of an unsigned short area that contains one of the following values:

  • For READ COMMITTED:

    a_rdb_SQL_TXN_READ_COMMITTED

  • For REPEATABLE READ:

    a_rdb_SQL_TXN_REPEATABLE_READ

  • If the specified value is changed into unspecified status (in which the transaction isolation level has never been set by using this CLI function):

    a_rdb_SQL_TXN_UNSPECIFIED

• When a sort order is set for character string data in a SELECT statement in which the ORDER BY clause is specified

Specify the address of the unsigned short area containing one of the following values:

  • Sorting of character string data by bytecode:

    a_rdb_SQL_ORDER_MODE_BYTE

  • Sorting of character string data by sort code (ISO/IEC 14651:2011 compliance):

    a_rdb_SQL_ORDER_MODE_ISO

  • If the specified value is changed into unspecified status (in which the sort order for character string data has never been set by using this CLI function):

    a_rdb_SQL_ORDER_MODE_UNSPECIFIED

• When the transaction access mode is set:

Specify the address of an unsigned short area in which one of the following values is set:

  • Read/write mode:

    a_rdb_SQL_ACCESS_MODE_READ_WRITE

  • Read-only mode:

    a_rdb_SQL_ACCESS_MODE_READ_ONLY

  • If the specified value is changed into unspecified status (in which the transaction access mode has never been set by using this CLI function):

    a_rdb_SQL_ACCESS_MODE_UNSPECIFIED

Option

Specifies NULL.

(4) Return value

  1. If a_rdb_SQLSetConnectAttr() terminates normally, a_rdb_RC_SQL_SUCCESS is returned.

  2. If the connection attributes have been set successfully but the disk containing client message log files has become full, a_rdb_RC_SQL_WARNING is returned.

  3. If an error occurs while messages cannot be output to the client message log file, the error cause code is returned. For details about the error cause code, see 19.8 Return values of the CLI functions.

(5) Notes

  1. a_rdb_SQLSetConnectAttr() cannot be executed in the following cases:

    • Connection has not been established.

    • The transaction has not been settled.

    • An invalid connection attribute is specified.

    • An invalid transaction isolation level is specified.

    • An invalid sort order for character string data is specified.

    • An invalid transaction access mode is specified.

  2. The transaction isolation level is determined in the priority order described below. A smaller number represents a higher priority (for example, 1 has a higher priority than 2).

    1. Transaction isolation level specified by a_rdb_SQLSetConnectAttr()

    2. Transaction isolation level specified in the adb_clt_trn_iso_lv client definition operand

    3. Transaction isolation level specified in the adb_sys_trn_iso_lv server definition operand

  3. The sort order for character string data is determined in the priority order shown below. A smaller number represents a higher the priority (for example, 1 has a higher priority than 2):

    1. Sort order specified by a_rdb_SQLSetConnectAttr()

    2. Sort order specified in the adb_clt_sql_order_mode client definition operand

    3. Sort order specified in the adb_sql_order_mode server definition operand

  4. The transaction access mode is determined in the priority order described below. A smaller number represents a higher priority (for example, 1 has a higher priority than 2).

    1. Transaction access mode specified with a_rdb_SQLSetConnectAttr()

    2. Transaction access mode specified in the adb_clt_trn_access_mode operand in the client definition