IIapi_autocommit() Function--Enable or Disable Autocommit Transactions
The IIapi_autocommit() function provides an interface for the front-end application to manage the autocommit state in a server. It controls the autocommit state of the server through an autocommit transaction handle. An autocommit transaction handle is required to access the Name Server through OpenAPI.
This function is called with a NULL transaction handle to enable the autocommit state in a server. For a DBMS connection, this is equivalent to the SQL statement SET AUTOCOMMIT ON. An autocommit transaction handle is returned to be used in place of a regular transaction handle in IIapi_query(). Query statements executed in the context of an autocommit transaction are automatically committed when they complete execution.
When called with an existing autocommit transaction handle, this function disables the autocommit state in the server. This is equivalent to the SQL statement SET AUTOCOMMIT OFF. The autocommit transaction handle is freed and cannot be referenced further by the application.
When you set autocommit on, a commit occurs automatically after every statement except prepare and describe. If autocommit is on and you open a cursor, the DBMS does not issue a commit until the close cursor statement is executed because cursors are logically a single statement.
This function has the following syntax:
II_VOID IIapi_autocommit( IIAPI_AUTOPARM *autoParm);
typedef struct _IIAPI_AUTOPARM
{
IIAPI_GENPARM ac_genParm;
II_PTR ac_connHandle;
II_PTR ac_tranHandle;
} IIAPI_AUTOPARM;
This function has the following parameters:
ac_genParm
Type: input and delayed output
Specifies the generic parameters.
ac_connHandle
Type: input
Specifies the connection handle identifying the connection associated with the autocommit transaction. Set to NULL when disabling an existing autocommit transaction.
ac_tranHandle
Type: input and immediate output
Specifies the transaction handle to be used while autocommit is enabled. Set to NULL when enabling an autocommit transaction.
Last modified date: 08/14/2024