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 "parser.pgc"
10 #include <stdio.h>
11 #include <stdlib.h>
12 #include <string.h>
13 
14 /* test parser addition that merges two tokens into one */
15 
16 #line 1 "regression.h"
17 
18 
19 
20 
21 
22 
23 #line 6 "parser.pgc"
24 
25 
main()26 int main() {
27   /* exec sql begin declare section */
28 
29 
30 #line 10 "parser.pgc"
31  int item [ 3 ] , ind [ 3 ] , i ;
32 /* exec sql end declare section */
33 #line 11 "parser.pgc"
34 
35 
36   ECPGdebug(1, stderr);
37   { ECPGconnect(__LINE__, 0, "ecpg1_regression" , NULL, NULL , NULL, 0); }
38 #line 14 "parser.pgc"
39 
40 
41   { ECPGsetcommit(__LINE__, "on", NULL);}
42 #line 16 "parser.pgc"
43 
44   /* exec sql whenever sql_warning  sqlprint ; */
45 #line 17 "parser.pgc"
46 
47   /* exec sql whenever sqlerror  sqlprint ; */
48 #line 18 "parser.pgc"
49 
50 
51   { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "create table T ( Item1 int , Item2 int )", ECPGt_EOIT, ECPGt_EORT);
52 #line 20 "parser.pgc"
53 
54 if (sqlca.sqlwarn[0] == 'W') sqlprint();
55 #line 20 "parser.pgc"
56 
57 if (sqlca.sqlcode < 0) sqlprint();}
58 #line 20 "parser.pgc"
59 
60 
61   { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "insert into t select 1 , nullif ( y - 1 , 0 ) from generate_series ( 1 , 3 ) with ordinality as series ( x , y )", ECPGt_EOIT, ECPGt_EORT);
62 #line 24 "parser.pgc"
63 
64 if (sqlca.sqlwarn[0] == 'W') sqlprint();
65 #line 24 "parser.pgc"
66 
67 if (sqlca.sqlcode < 0) sqlprint();}
68 #line 24 "parser.pgc"
69 
70 
71   { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select Item2 from T order by Item2 nulls last", ECPGt_EOIT,
72 	ECPGt_int,(item),(long)1,(long)3,sizeof(int),
73 	ECPGt_int,(ind),(long)1,(long)3,sizeof(int), ECPGt_EORT);
74 #line 26 "parser.pgc"
75 
76 if (sqlca.sqlwarn[0] == 'W') sqlprint();
77 #line 26 "parser.pgc"
78 
79 if (sqlca.sqlcode < 0) sqlprint();}
80 #line 26 "parser.pgc"
81 
82 
83   for (i=0; i<3; i++)
84 	printf("item[%d] = %d\n", i, ind[i] ? -1 : item[i]);
85 
86   { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "alter table T alter Item1 type bigint", ECPGt_EOIT, ECPGt_EORT);
87 #line 31 "parser.pgc"
88 
89 if (sqlca.sqlwarn[0] == 'W') sqlprint();
90 #line 31 "parser.pgc"
91 
92 if (sqlca.sqlcode < 0) sqlprint();}
93 #line 31 "parser.pgc"
94 
95   { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "alter table T alter column Item2 set data type smallint", ECPGt_EOIT, ECPGt_EORT);
96 #line 32 "parser.pgc"
97 
98 if (sqlca.sqlwarn[0] == 'W') sqlprint();
99 #line 32 "parser.pgc"
100 
101 if (sqlca.sqlcode < 0) sqlprint();}
102 #line 32 "parser.pgc"
103 
104 
105   { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "drop table T", ECPGt_EOIT, ECPGt_EORT);
106 #line 34 "parser.pgc"
107 
108 if (sqlca.sqlwarn[0] == 'W') sqlprint();
109 #line 34 "parser.pgc"
110 
111 if (sqlca.sqlcode < 0) sqlprint();}
112 #line 34 "parser.pgc"
113 
114 
115   { ECPGdisconnect(__LINE__, "ALL");
116 #line 36 "parser.pgc"
117 
118 if (sqlca.sqlwarn[0] == 'W') sqlprint();
119 #line 36 "parser.pgc"
120 
121 if (sqlca.sqlcode < 0) sqlprint();}
122 #line 36 "parser.pgc"
123 
124 
125   return 0;
126 }
127