0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017 #ifndef TX_H
0018 #define TX_H
0019 #define TX_H_VERSION 0
0020
0021 #include <ndrx_config.h>
0022 #include <xa.h>
0023
0024
0025
0026
0027
0028
0029
0030
0031 typedef long COMMIT_RETURN;
0032 #define TX_COMMIT_COMPLETED 0
0033 #define TX_COMMIT_DECISION_LOGGED 1
0034
0035 typedef long TRANSACTION_CONTROL;
0036 #define TX_UNCHAINED 0
0037 #define TX_CHAINED 1
0038
0039 typedef long TRANSACTION_TIMEOUT;
0040
0041 typedef long TRANSACTION_STATE;
0042
0043 #define TX_ACTIVE 0
0044 #define TX_TIMEOUT_ROLLBACK_ONLY 1
0045 #define TX_ROLLBACK_ONLY 2
0046
0047 struct tx_info_t {
0048 XID xid;
0049 COMMIT_RETURN when_return;
0050 TRANSACTION_CONTROL transaction_control;
0051 TRANSACTION_TIMEOUT transaction_timeout;
0052 TRANSACTION_STATE transaction_state;
0053 };
0054 typedef struct tx_info_t TXINFO;
0055
0056
0057
0058
0059 extern NDRX_API int tx_begin(void);
0060 extern NDRX_API int tx_close(void);
0061 extern NDRX_API int tx_commit(void);
0062 extern NDRX_API int tx_info(TXINFO *);
0063 extern NDRX_API int tx_open(void);
0064 extern NDRX_API int tx_rollback(void);
0065 extern NDRX_API int tx_set_commit_return(COMMIT_RETURN);
0066 extern NDRX_API int tx_set_transaction_control(TRANSACTION_CONTROL);
0067 extern NDRX_API int tx_set_transaction_timeout(TRANSACTION_TIMEOUT);
0068
0069
0070
0071
0072 #define TX_NOT_SUPPORTED 1
0073 #define TX_OK 0
0074 #define TX_OUTSIDE -1
0075
0076 #define TX_ROLLBACK -2
0077 #define TX_MIXED -3
0078
0079
0080
0081 #define TX_HAZARD -4
0082
0083 #define TX_PROTOCOL_ERROR -5
0084
0085 #define TX_ERROR -6
0086 #define TX_FAIL -7
0087 #define TX_EINVAL -8
0088 #define TX_COMMITTED -9
0089
0090 #define TX_NO_BEGIN -100
0091
0092 #define TX_ROLLBACK_NO_BEGIN (TX_ROLLBACK+TX_NO_BEGIN)
0093
0094
0095 #define TX_MIXED_NO_BEGIN (TX_MIXED+TX_NO_BEGIN)
0096
0097
0098 #define TX_HAZARD_NO_BEGIN (TX_HAZARD+TX_NO_BEGIN)
0099
0100
0101 #define TX_COMMITTED_NO_BEGIN (TX_COMMITTED+TX_NO_BEGIN)
0102
0103
0104 #endif
0105
0106
0107
0108