Client-Library uses a connection state machine to verify that applications call Client-Library routines in a logical sequence. See Chapter 2, “Program Structure” in the Open Client Client-Library/C Programmer’s Guide for an explanation of the steps involved in structuring a Client-Library application.
The assumption underlying the use of threads is that when a thread disassociates from a transaction branch, it leaves the state machine in an inactive state. By default, all Embedded SQL statements leave the connection quiescent. With Client-Library, this is true only in the following circumstances:
When ct_results returns CS_END_RESULTS, or CS_SUCCEED with a result type of CS_CURSOR_RESULT.
After an application calls ct_cancel with type as CS_CANCEL_ALL.
When an application returns CS_CANCELED. The APIs that return CS_CANCELED include ct_send(), ct_results(), and ct_get_data().
WARNING! If connections are not left in an inactive state, the consequences may include transaction rollbacks, extra overhead as the XA Interface cleans up the connection (which may require full connection close and reopen), and the possible failure of subsequent transactions. In such a situation, XA Interface attempts to maintain application operation while it minimizes failure.