1 /* Processed by ecpg (regression mode) */
2 /* These include files are added by the preprocessor */
6 /* End of automatic include section */
7 #define ECPGdebug(X,Y) ECPGdebug((X)+100,(Y))
15 #line 1 "regression.h"
26 /* exec sql begin declare section */
35 /* exec sql end declare section */
40 { ECPGconnect(__LINE__, 0, "regress1" , NULL, NULL , NULL, 0); }
44 /* exec sql whenever sql_warning sqlprint ; */
47 /* exec sql whenever sqlerror sqlprint ; */
51 { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "create table My_Table ( Item1 int , Item2 text )", ECPGt_EOIT, ECPGt_EORT);
54 if (sqlca.sqlwarn[0] == 'W') sqlprint();
57 if (sqlca.sqlcode < 0) sqlprint();}
61 { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "insert into My_Table values ( 1 , 'text1' )", ECPGt_EOIT, ECPGt_EORT);
64 if (sqlca.sqlwarn[0] == 'W') sqlprint();
67 if (sqlca.sqlcode < 0) sqlprint();}
70 { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "insert into My_Table values ( 2 , 'text2' )", ECPGt_EOIT, ECPGt_EORT);
73 if (sqlca.sqlwarn[0] == 'W') sqlprint();
76 if (sqlca.sqlcode < 0) sqlprint();}
79 { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "insert into My_Table values ( 3 , 'text3' )", ECPGt_EOIT, ECPGt_EORT);
82 if (sqlca.sqlwarn[0] == 'W') sqlprint();
85 if (sqlca.sqlcode < 0) sqlprint();}
88 { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "insert into My_Table values ( 4 , 'text4' )", ECPGt_EOIT, ECPGt_EORT);
91 if (sqlca.sqlwarn[0] == 'W') sqlprint();
94 if (sqlca.sqlcode < 0) sqlprint();}
98 /* declare C cursor for select * from My_Table */
102 { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare C cursor for select * from My_Table", ECPGt_EOIT, ECPGt_EORT);
105 if (sqlca.sqlwarn[0] == 'W') sqlprint();
108 if (sqlca.sqlcode < 0) sqlprint();}
112 /* exec sql whenever not found break ; */
116 { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch 1 in C", ECPGt_EOIT,
117 ECPGt_int,&(i),(long)1,(long)1,sizeof(int),
118 ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
119 ECPGt_char,(str),(long)25,(long)1,(25)*sizeof(char),
120 ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
123 if (sqlca.sqlcode == ECPG_NOT_FOUND) break;
126 if (sqlca.sqlwarn[0] == 'W') sqlprint();
129 if (sqlca.sqlcode < 0) sqlprint();}
132 printf("%d: %s\n", i, str);
135 /* exec sql whenever not found continue ; */
138 { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "move backward 2 in C", ECPGt_EOIT, ECPGt_EORT);
141 if (sqlca.sqlwarn[0] == 'W') sqlprint();
144 if (sqlca.sqlcode < 0) sqlprint();}
148 { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch $0 in C",
149 ECPGt_int,&(count),(long)1,(long)1,sizeof(int),
150 ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT,
151 ECPGt_int,&(i),(long)1,(long)1,sizeof(int),
152 ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
153 ECPGt_char,(str),(long)25,(long)1,(25)*sizeof(char),
154 ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
157 if (sqlca.sqlwarn[0] == 'W') sqlprint();
160 if (sqlca.sqlcode < 0) sqlprint();}
163 printf("%d: %s\n", i, str);
165 { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close C", ECPGt_EOIT, ECPGt_EORT);
168 if (sqlca.sqlwarn[0] == 'W') sqlprint();
171 if (sqlca.sqlcode < 0) sqlprint();}
175 /* declare D cursor for select * from My_Table where Item1 = $1 */
179 { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare D cursor for select * from My_Table where Item1 = $1",
180 ECPGt_const,"1",(long)1,(long)1,strlen("1"),
181 ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
184 if (sqlca.sqlwarn[0] == 'W') sqlprint();
187 if (sqlca.sqlcode < 0) sqlprint();}
191 /* exec sql whenever not found break ; */
195 { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch 1 in D", ECPGt_EOIT,
196 ECPGt_int,&(i),(long)1,(long)1,sizeof(int),
197 ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
198 ECPGt_char,(str),(long)25,(long)1,(25)*sizeof(char),
199 ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
202 if (sqlca.sqlcode == ECPG_NOT_FOUND) break;
205 if (sqlca.sqlwarn[0] == 'W') sqlprint();
208 if (sqlca.sqlcode < 0) sqlprint();}
211 printf("%d: %s\n", i, str);
213 { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close D", ECPGt_EOIT, ECPGt_EORT);
216 if (sqlca.sqlwarn[0] == 'W') sqlprint();
219 if (sqlca.sqlcode < 0) sqlprint();}
223 { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "drop table My_Table", ECPGt_EOIT, ECPGt_EORT);
226 if (sqlca.sqlwarn[0] == 'W') sqlprint();
229 if (sqlca.sqlcode < 0) sqlprint();}
233 { ECPGdisconnect(__LINE__, "ALL");
236 if (sqlca.sqlwarn[0] == 'W') sqlprint();
239 if (sqlca.sqlcode < 0) sqlprint();}