isc_commit_transaction()
Go Up to API Function Reference
Commits a specified active transaction.
Syntax
ISC_STATUS isc_commit_transaction(
ISC_STATUS *status_vector,
isc_tr_handle *trans_handle);
Parameter | Type | Description |
---|---|---|
|
|
Pointer to the error status vector |
|
|
Pointer to a transaction handle whose value has been set by a previous |
Description
isc_commit_transaction()
closes record streams, frees system resources, and sets the transaction handle to zero for the specified transaction.
When you call this function to execute a commit operation against multiple databases, InterBase first initiates a call to the isc_prepare_transaction()
function. isc_prepare_transaction()
executes the first phase of a two-phase commit. This puts the transaction into limbo and signals your intention to commit, so that InterBase can poll all target databases to verify that they are ready to accept the commit. Also, isc_commit_transaction()
writes a Blob message to the RDB$TRANSACTION_DESCRIPTION
column of the RDB$TRANSACTIONS
system table, detailing information required by InterBase to perform a reconnect in case of system failure during the commit process.
The isc_commit_transaction()
function also performs the second phase of a two-phase commit upon receiving verification that all databases are ready to accept the commit. Also, isc_commit_transaction()
cleans up RDB$TRANSACTIONS
.
Example
The following call commits a transaction and prints a message:
isc_commit_transaction(status, &trans); if (status[0] == 1 && status[1]) { fprintf(stderr, "Error on write\n"); isc_print_status(status); }
Return value
isc_commit_transaction()
returns the second element of the status vector. Zero indicates success. A nonzero value indicates an error. For InterBase errors, the first element of the status vector is set to 1, and the second element is set to an InterBase error code.
To check for an InterBase error, examine the first two elements of the status vector directly. For more information about examining the status vector, see Handling Error Conditions.