1 /* Processed by ecpg (regression mode) */
2 /* These include files are added by the preprocessor */
3 #include <ecpglib.h>
4 #include <ecpgerrno.h>
5 #include <sqlca.h>
6 /* End of automatic include section */
7 #define ECPGdebug(X,Y) ECPGdebug((X)+100,(Y))
8
9 #line 1 "twophase.pgc"
10 #include <stdio.h>
11 #include <stdlib.h>
12 #include <string.h>
13
14
15 #line 1 "regression.h"
16
17
18
19
20
21
22 #line 5 "twophase.pgc"
23
24
25 /* exec sql whenever sqlerror sqlprint ; */
26 #line 7 "twophase.pgc"
27
28
main(void)29 int main(void)
30 {
31 char msg[128];
32
33 ECPGdebug(1, stderr);
34
35 strcpy(msg, "connect");
36 { ECPGconnect(__LINE__, 0, "ecpg1_regression" , NULL, NULL , NULL, 0);
37 #line 16 "twophase.pgc"
38
39 if (sqlca.sqlcode < 0) sqlprint();}
40 #line 16 "twophase.pgc"
41
42 { ECPGsetcommit(__LINE__, "off", NULL);
43 #line 17 "twophase.pgc"
44
45 if (sqlca.sqlcode < 0) sqlprint();}
46 #line 17 "twophase.pgc"
47
48
49 strcpy(msg, "create");
50 { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "create table t1 ( c int )", ECPGt_EOIT, ECPGt_EORT);
51 #line 20 "twophase.pgc"
52
53 if (sqlca.sqlcode < 0) sqlprint();}
54 #line 20 "twophase.pgc"
55
56
57 strcpy(msg, "commit");
58 { ECPGtrans(__LINE__, NULL, "commit");
59 #line 23 "twophase.pgc"
60
61 if (sqlca.sqlcode < 0) sqlprint();}
62 #line 23 "twophase.pgc"
63
64
65 strcpy(msg, "begin");
66 { ECPGtrans(__LINE__, NULL, "begin");
67 #line 26 "twophase.pgc"
68
69 if (sqlca.sqlcode < 0) sqlprint();}
70 #line 26 "twophase.pgc"
71
72
73 strcpy(msg, "insert");
74 { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "insert into t1 values ( 1 )", ECPGt_EOIT, ECPGt_EORT);
75 #line 29 "twophase.pgc"
76
77 if (sqlca.sqlcode < 0) sqlprint();}
78 #line 29 "twophase.pgc"
79
80
81 strcpy(msg, "prepare transaction");
82 { ECPGtrans(__LINE__, NULL, "prepare transaction 'gxid'");
83 #line 32 "twophase.pgc"
84
85 if (sqlca.sqlcode < 0) sqlprint();}
86 #line 32 "twophase.pgc"
87
88
89 strcpy(msg, "commit prepared");
90 { ECPGtrans(__LINE__, NULL, "commit prepared 'gxid'");
91 #line 35 "twophase.pgc"
92
93 if (sqlca.sqlcode < 0) sqlprint();}
94 #line 35 "twophase.pgc"
95
96
97 strcpy(msg, "drop");
98 { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "drop table t1", ECPGt_EOIT, ECPGt_EORT);
99 #line 38 "twophase.pgc"
100
101 if (sqlca.sqlcode < 0) sqlprint();}
102 #line 38 "twophase.pgc"
103
104
105 strcpy(msg, "disconnect");
106 { ECPGdisconnect(__LINE__, "CURRENT");
107 #line 41 "twophase.pgc"
108
109 if (sqlca.sqlcode < 0) sqlprint();}
110 #line 41 "twophase.pgc"
111
112
113 return 0;
114 }
115