Age Owner TLA Line data Source code
1 : exec sql include sqlca;
2 :
3 : enum e { ENUM0, ENUM1 };
4 : struct sa { int member; };
5 :
6060 meskes 6 CBC 2 : static int fa(void)
7 : {
8 2 : printf("in fa\n");
9 2 : return 2;
10 : }
11 :
12 : static int
13 2 : fb(int x)
14 : {
15 2 : printf("in fb (%d)\n", x);
16 2 : return x;
17 : }
18 :
19 : static int
20 1 : fc(const char *x)
21 : {
22 1 : printf("in fc (%s)\n", x);
23 1 : return *x;
24 : }
25 :
26 1 : static int fd(const char *x,int i)
27 : {
28 1 : printf("in fd (%s, %d)\n", x, i);
29 1 : return (*x)*i;
30 : }
31 :
32 1 : static int fe(enum e x)
33 : {
34 1 : printf("in fe (%d)\n", (int) x);
35 1 : return (int)x;
36 : }
37 :
1986 peter_e 38 1 : static void sqlnotice(const char *notice, short trans)
39 : {
6060 meskes 40 1 : if (!notice)
41 1 : notice = "-empty-";
42 1 : printf("in sqlnotice (%s, %d)\n", notice, trans);
43 1 : }
44 :
45 : exec sql define NONO 0;
46 :
47 : #define YES 1
48 :
49 : #ifdef _cplusplus
50 : namespace N
51 : {
52 : static const int i=2;
53 : };
54 : #endif
55 :
56 1 : int main(void)
57 : {
58 1 : struct sa x = { 14 },*y = &x;
59 : exec sql begin declare section;
60 1 : int a=(int)2;
61 1 : int b=2+2;
62 1 : int b2=(14*7);
63 1 : int d=x.member;
64 1 : int g=fb(2);
65 1 : int i=3^1;
66 1 : int j=1?1:2;
67 :
68 1 : int e=y->member;
69 1 : int c=10>>2;
4520 peter_e 70 1 : bool h=2||1;
71 : long iay /* = 1L */ ;
72 : exec sql end declare section;
73 :
6060 meskes 74 1 : int f=fa();
75 :
76 : #ifdef _cplusplus
77 : exec sql begin declare section;
78 : int k=N::i; /* compile error */
79 : exec sql end declare section;
80 : #endif
81 :
82 : ECPGdebug(1, stderr);
83 :
84 : printf("%d %d %d %d %d %d %d %d %d %d %d\n", a, b, b2, c, d, e, f, g, h, i, j);
85 : iay = 0;
86 : printf("%ld\n", iay);
87 1 : exec sql whenever sqlerror do fa();
88 1 : exec sql select now();
89 2 : exec sql whenever sqlerror do fb(20);
90 1 : exec sql select now();
91 2 : exec sql whenever sqlerror do fc("50");
92 1 : exec sql select now();
93 1 : exec sql whenever sqlerror do fd("50",1);
94 1 : exec sql select now();
95 1 : exec sql whenever sqlerror do fe(ENUM0);
96 1 : exec sql select now();
4520 peter_e 97 1 : exec sql whenever sqlerror do sqlnotice(NULL, NONO);
6060 meskes 98 1 : exec sql select now();
99 1 : return 0;
100 : }
|