1 /* File:			connexp.h
2  *
3  * Description:		See "connection.c"
4  *
5  * Comments:		See "notice.txt" for copyright and license information.
6  *
7  */
8 
9 #ifndef __CONNEXPORT_H__
10 #define __CONNEXPORT_H__
11 
12 /*
13  *	The psqlodbc dll exports functions below used in the pgenlist dll.
14  *
15  */
16 
17 #undef	DLL_DECLARE
18 #ifdef	_PGDTC_FUNCS_IMPLEMENT_
19 #define	DLL_DECLARE	_declspec(dllexport)
20 #else
21 #ifdef	_PGDTC_FUNCS_IMPORT_
22 #define	DLL_DECLARE	_declspec(dllimport)
23 #else
24 #define	DLL_DECLARE
25 #endif /* _PGDTC_FUNC_IMPORT_ */
26 #endif /* _PGDTC_FUNCS_IMPLEMENT_ */
27 
28 #ifdef	__cplusplus
29 extern "C" {
30 #endif
31 
32 #define	KEYWORD_DTC_CHECK	"dtchk"
33 #define	DTC_CHECK_LINK_ONLY	1
34 #define	DTC_CHECK_BEFORE_LINK	2
35 #define	DTC_CHECK_RM_CONNECTION	3
36 
37 /*	Property */
38 enum {
39 	inprogress
40 	,enlisted
41 	,inTrans			/* read-only */
42 	,errorNumber			/* read_only */
43 	,idleInGlobalTransaction	/* read-only */
44 	,connected			/* read-only */
45 	,prepareRequested
46 };
47 
48 /* 	PgDtc_isolate option */
49 enum {
50 	disposingConnection = 1L
51 	,useAnotherRoom = (1L << 1)
52 };
53 
54 /* 	One phase commit operations */
55 enum {
56 	ONE_PHASE_COMMIT = 0
57 	,ONE_PHASE_ROLLBACK
58 	,ABORT_GLOBAL_TRANSACTION
59 	,SHUTDOWN_LOCAL_TRANSACTION
60 };
61 
62 /* 	Two phase commit operations */
63 enum {
64 	PREPARE_TRANSACTION = 0
65 	,COMMIT_PREPARED
66 	,ROLLBACK_PREPARED
67 };
68 
69 DLL_DECLARE void PgDtc_create_connect_string(void *self, char *connstr, int strsize);
70 DLL_DECLARE int  PgDtc_is_recovery_available(void *self, char *reason, int rsize);
71 DLL_DECLARE void PgDtc_set_async(void *self, void *async);
72 DLL_DECLARE void *PgDtc_get_async(void *self);
73 DLL_DECLARE void PgDtc_set_property(void *self, int property, void *value);
74 DLL_DECLARE void PgDtc_set_error(void *self, const char *message, const char *func);
75 DLL_DECLARE int	 PgDtc_get_property(void *self, int property);
76 DLL_DECLARE BOOL PgDtc_connect(void *self);
77 DLL_DECLARE void PgDtc_free_connect(void *self);
78 DLL_DECLARE BOOL PgDtc_one_phase_operation(void *self, int operation);
79 DLL_DECLARE BOOL PgDtc_two_phase_operation(void *self, int operation, const char *gxid);
80 DLL_DECLARE BOOL PgDtc_lock_cntrl(void *self, BOOL acquire, BOOL bTrial);
81 DLL_DECLARE void *PgDtc_isolate(void *self, DWORD option);
82 
83 #ifdef	__cplusplus
84 }
85 #endif
86 #endif /* __CONNEXPORT_H__ */
87