SQLEndTran
SQLEndTran#
SQLEndTran requests a commit or rollback operation for all active operations on all statements associated with a connection. SQLEndTran can also request that a commit or rollback operation be performed for all connections associated with an environment.
Syntax#
SQLRETURN SQLEndTran (
SQLSMALLINT handleType,
SQLHENV handle,
SQLSMALLINT type );
Arguments#
Data Type | Argument | In/Output | Description |
---|---|---|---|
SQLSMALLINT | handleType | Input | Handle type identifier. it should be eitherSQL_HANDLE_ENV or SQL_HANDLE_DBC. |
SQLHENV | handle | Input | Type indicated by * handleType * |
SQLSMALLINT | type | Input | One of the following two values: SQL_COMMIT SQL_ROLLBACK |
Return Values#
SQL_SUCCESS
SQL_SUCCESS_WITH_INFO
SQL_INVALID_HANDLE
SQL_ERROR
Description#
If the handleType is SQL_HANDLE_ENV and the handle is effective environment handle, the Altibase CLI driver will call SQLEndTran() for each connection handle related to the environment. The handle argument to call the Altibase CLI API must be the environment handle of the Altibase CLI. In this case, the Altibase CLI driver may commit the transaction or attempt to rollback depending on the type in the connected status.
If the type is SQL_COMMIT, SQLEndTran() will send commit command to the session related to the connection. If the type is SQL_ROLLBACK, SQLEndTran() will give rollback request to the connection-related session.
In case of the manual commit mode, by calling SQLSetConnectAttr() that can set SQL_ATTR_AutoCommit statement attribute as SQL_AutoCommit_OFF, the new transaction will internally start when a SQL statement to be included in the transaction is executed.
Diagnosis#
SQLSTATE | Description | Comments |
---|---|---|
HY000 | General error |
Related Funciton#
SQLFreeHandle
SQLFreeStmt
Example#
< Refer to: $ALTIBASE_HOME/sample/SQLCLI/demo_tran1.cpp >
SQLEndTran(SQL_HANDLE_DBC, dbc, SQL_COMMIT);