The access method can register an end-of-transaction callback function to handle the MI_EVENT_END_XACT event, which the database server raises at the end of a transaction. In that callback function, test the return value of the DataBlade API mi_transition_type() function to determine the state of the transaction, as follows.
| Return Value for
mi_transition_type() |
Transaction State |
|---|---|
| MI_NORMAL_END | Successful transaction completion The database server can commit the data. |
| MI_ABORT_END | Unsuccessful transaction completion The database server must roll back the index to its state before the transaction began. |
As long as a transaction is in progress, the access method should save each original source record value before it executes a delete or update. For transactions that include both internal and external objects, the access method can include either an end-of-transaction or end-of-statement callback function to ensure the correct end-of-transaction action. Depending on the value that mi_transition_type() returns, the callback function either commits or rolls back (if possible) the operations on the external objects.
If an external transaction does not completely commit, the access method must notify the database server to roll back any effects of the transaction on state of the virtual index.
For detailed information about the following subjects, refer to the IBM Informix: DataBlade API Programmer's Guide:
For an example of a secondary access method that provides a state-transition callback function, see the indexing information on the IBM Informix Developer Zone at www.ibm.com/software/data/developer/informix.
Home | [ Top of Page | Previous Page | Next Page | Contents | Index ]