Transactions Usage
To use transactions, do the following:
| 1. | Create a transaction on the server using lkt_tran_create. |
| 2. | Perform operations under the transaction using the lkt_xxxT functions, passing the transaction parameters created in step 1. |
| 3. | Commit or roll back the transaction using lkt_tran_commit or lkt_tran_abort. |
The application must roll back or commit a transaction. The application can consider conditions outside the TIBCO Patterns server (for example a failed SQL operation) when choosing between committing or rolling back a transaction.
If an operation encounters an error on the TIBCO Patterns server, it is recommended that the application roll back the containing transaction. Committing such transactions might leave data in an unknown and incorrect state.
Transaction Information in Object Statistics
Object statistics (table stats, character-map stats, thesaurus stats, and Learn model stats) have additional information about their transactional status. The transaction which has modified or locked the object for use is reported in LPAR_LONGINT_TRAN_ID. The transactional state of the object is reported in LPAR_INT_TRAN_OBJ_STATE.
LPAR_INT_TRAN_OBJ_STATE values
|
LKT_TRAN_OBJ_NULL |
a special internal value indicating an object that does not exist. This value should not be returned outside the Devkit. It is exclusive of all other values. |
|
LKT_TRAN_OBJ_EXISTS |
the value for an object that exists. All objects have this state. |
|
LKT_TRAN_OBJ_UPDATED |
an object whose content has been updated by an open transaction |
|
LKT_TRAN_OBJ_HELD |
an object on which an open transaction has placed a hold without modifying it |
|
LKT_TRAN_OBJ_ADDED |
an object that was added by an open transaction |
|
LKT_TRAN_OBJ_RENAMED |
an object that was renamed to its current name by an open transaction |
|
LKT_TRAN_OBJ_REPLACED |
all the contents of this object were replaced by an open transaction. Checkpoint and restore operations are considered to replace the table. |
|
LKT_TRAN_OBJ_DELETED |
the object that was deleted by an open transaction. This state cannot be experienced as this object was deleted. |
|
LKT_TRAN_OBJ_MIXED |
a special state value that is reported in object status reports when the nodes of a cluster report two or more different states. No object ever actually has this state. |
Transaction Conflicts
When you attempt to modify the same object under two transactions, the second attempt returns a DVK_ERR_TRANCONFLICT error code, and the error item is a list of two lpars:
| • | LPAR_LONGINT_TRAN_ID: the ID of the conflicting transaction |
| • | LPAR_STR_ERRORDETAILS: a message string with the format, “Tran. <ID> Action <int> Conflicts with <ID> on object: <object name>” |