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