Hitachi

Hitachi Advanced Database Application Development Guide


19.3.2 a_rdb_SQLEndTran() (terminate the transaction)

Organization of this subsection

(1) Function

This CLI function terminates the transaction. When the transaction is completed, all statement handles in effect at that point are released.

(2) Format

signed short a_rdb_SQLEndTran
(
  void                          *ConnectionHandle,   /* In */
  unsigned short                 CompletionType,     /* In */
  void                          *Option              /* In */
)

(3) Arguments

ConnectionHandle

Specifies a connection handle.

CompletionType

Specifies one of the following values:

  • a_rdb_SQL_COMMIT: Specifies that COMMIT (normal termination of transaction) is to be executed.

  • a_rdb_SQL_ROLLBACK: Specifies that ROLLBACK (cancellation of transaction) is to be executed.

Option

Specifies NULL.

(4) Return value

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

  2. If the transaction is terminated successfully, but the disk containing server message log files or 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. If a row fetching error is detected during the cursor close processing that is executed as an extension of the COMMIT processing, ROLLBACK processing is performed automatically, in which case the transaction does not terminate normally. If COMMIT fails for any other reason, the HADB server terminates abnormally.

  2. If ROLLBACK fails, the HADB server terminates abnormally.

  3. a_rdb_SQLEndTran() cannot be executed in the following cases:

    • Connection has not been established.

    • An invalid value is specified for CompletionType.

    • A row fetching error is detected during the cursor close processing that is executed as an extension of the COMMIT processing.

  4. If COMMIT or ROLLBACK processing is performed on the transaction as a result of executing a_rdb_SQLEndTran(), the following occurs:

    • All open cursors are closed.

    • Any preprocessed SQL statement is ignored.

    • Statement handles are all released.