1 /* Processed by ecpg (4.2.1) */
2 /* These include files are added by the preprocessor */
7 /* End of automatic include section */
16 #line 1 "regression.h"
26 /* exec sql whenever sqlerror sqlprint ; */
33 /* exec sql begin declare section */
40 #line 14 "execute.pgc"
43 #line 15 "execute.pgc"
46 #line 16 "execute.pgc"
49 #line 17 "execute.pgc"
52 #line 18 "execute.pgc"
55 /* exec sql end declare section */
56 #line 19 "execute.pgc"
64 ECPGconnect(__LINE__, 0, "regress1", NULL, NULL, "main", 0);
65 #line 24 "execute.pgc"
67 if (sqlca.sqlcode < 0)
70 #line 24 "execute.pgc"
73 ECPGdo(__LINE__, 0, 1, NULL, "create table test ( name char ( 8 ) , amount int , letter char ( 1 ) ) ", ECPGt_EOIT, ECPGt_EORT);
74 #line 25 "execute.pgc"
76 if (sqlca.sqlcode < 0)
79 #line 25 "execute.pgc"
82 ECPGtrans(__LINE__, NULL, "commit");
83 #line 26 "execute.pgc"
85 if (sqlca.sqlcode < 0)
88 #line 26 "execute.pgc"
91 sprintf(command, "insert into test (name, amount, letter) values ('db: ''r1''', 1, 'f')");
93 ECPGdo(__LINE__, 0, 1, NULL, "?",
94 ECPGt_char_variable, (command), (long) 1, (long) 1, (1) * sizeof(char),
95 ECPGt_NO_INDICATOR, NULL, 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
96 #line 29 "execute.pgc"
98 if (sqlca.sqlcode < 0)
101 #line 29 "execute.pgc"
104 sprintf(command, "insert into test (name, amount, letter) values ('db: ''r1''', 2, 't')");
106 ECPGdo(__LINE__, 0, 1, NULL, "?",
107 ECPGt_char_variable, (command), (long) 1, (long) 1, (1) * sizeof(char),
108 ECPGt_NO_INDICATOR, NULL, 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
109 #line 32 "execute.pgc"
111 if (sqlca.sqlcode < 0)
114 #line 32 "execute.pgc"
117 sprintf(command, "insert into test (name, amount, letter) select name, amount+10, letter from test");
119 ECPGdo(__LINE__, 0, 1, NULL, "?",
120 ECPGt_char_variable, (command), (long) 1, (long) 1, (1) * sizeof(char),
121 ECPGt_NO_INDICATOR, NULL, 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
122 #line 35 "execute.pgc"
124 if (sqlca.sqlcode < 0)
127 #line 35 "execute.pgc"
130 printf("Inserted %ld tuples via execute immediate\n", sqlca.sqlerrd[2]);
132 sprintf(command, "insert into test (name, amount, letter) select name, amount+?, letter from test");
134 ECPGprepare(__LINE__, "I", command);
135 #line 40 "execute.pgc"
137 if (sqlca.sqlcode < 0)
140 #line 40 "execute.pgc"
143 ECPGdo(__LINE__, 0, 1, NULL, "?",
144 ECPGt_char_variable, (ECPGprepared_statement("I")), (long) 1, (long) 1, (1) * sizeof(char),
145 ECPGt_NO_INDICATOR, NULL, 0L, 0L, 0L,
146 ECPGt_int, &(increment), (long) 1, (long) 1, sizeof(int),
147 ECPGt_NO_INDICATOR, NULL, 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
148 #line 41 "execute.pgc"
150 if (sqlca.sqlcode < 0)
153 #line 41 "execute.pgc"
156 printf("Inserted %ld tuples via prepared execute\n", sqlca.sqlerrd[2]);
159 ECPGtrans(__LINE__, NULL, "commit");
160 #line 45 "execute.pgc"
162 if (sqlca.sqlcode < 0)
165 #line 45 "execute.pgc"
168 sprintf(command, "select * from test");
171 ECPGprepare(__LINE__, "F", command);
172 #line 49 "execute.pgc"
174 if (sqlca.sqlcode < 0)
177 #line 49 "execute.pgc"
179 /* declare CUR cursor for ? */
180 #line 50 "execute.pgc"
184 ECPGdo(__LINE__, 0, 1, NULL, "declare CUR cursor for ?",
185 ECPGt_char_variable, (ECPGprepared_statement("F")), (long) 1, (long) 1, (1) * sizeof(char),
186 ECPGt_NO_INDICATOR, NULL, 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
187 #line 52 "execute.pgc"
189 if (sqlca.sqlcode < 0)
192 #line 52 "execute.pgc"
195 ECPGdo(__LINE__, 0, 1, NULL, "fetch 8 in CUR", ECPGt_EOIT,
196 ECPGt_char, (name), (long) 8, (long) 8, (8) * sizeof(char),
197 ECPGt_NO_INDICATOR, NULL, 0L, 0L, 0L,
198 ECPGt_int, (amount), (long) 1, (long) 8, sizeof(int),
199 ECPGt_NO_INDICATOR, NULL, 0L, 0L, 0L,
200 ECPGt_char, (letter), (long) 1, (long) 8, (1) * sizeof(char),
201 ECPGt_NO_INDICATOR, NULL, 0L, 0L, 0L, ECPGt_EORT);
202 #line 53 "execute.pgc"
204 if (sqlca.sqlcode < 0)
207 #line 53 "execute.pgc"
210 for (i = 0, j = sqlca.sqlerrd[2]; i < j; i++)
212 /* exec sql begin declare section */
216 #line 58 "execute.pgc"
220 #line 59 "execute.pgc"
223 /* exec sql end declare section */
224 #line 60 "execute.pgc"
227 strncpy(n, name[i], 8);
228 printf("name[%d]=%8.8s\tamount[%d]=%d\tletter[%d]=%c\n", i, n, i, a, i, l);
232 ECPGdo(__LINE__, 0, 1, NULL, "close CUR", ECPGt_EOIT, ECPGt_EORT);
233 #line 66 "execute.pgc"
235 if (sqlca.sqlcode < 0)
238 #line 66 "execute.pgc"
241 sprintf(command, "select * from test where amount = ?");
244 ECPGprepare(__LINE__, "F", command);
245 #line 70 "execute.pgc"
247 if (sqlca.sqlcode < 0)
250 #line 70 "execute.pgc"
252 /* declare CUR2 cursor for ? */
253 #line 71 "execute.pgc"
257 ECPGdo(__LINE__, 0, 1, NULL, "declare CUR2 cursor for ?",
258 ECPGt_char_variable, (ECPGprepared_statement("F")), (long) 1, (long) 1, (1) * sizeof(char),
259 ECPGt_NO_INDICATOR, NULL, 0L, 0L, 0L,
260 ECPGt_const, "1", (long) 1, (long) 1, strlen("1"),
261 ECPGt_NO_INDICATOR, NULL, 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
262 #line 73 "execute.pgc"
264 if (sqlca.sqlcode < 0)
267 #line 73 "execute.pgc"
270 ECPGdo(__LINE__, 0, 1, NULL, "fetch in CUR2", ECPGt_EOIT,
271 ECPGt_char, (name), (long) 8, (long) 8, (8) * sizeof(char),
272 ECPGt_NO_INDICATOR, NULL, 0L, 0L, 0L,
273 ECPGt_int, (amount), (long) 1, (long) 8, sizeof(int),
274 ECPGt_NO_INDICATOR, NULL, 0L, 0L, 0L,
275 ECPGt_char, (letter), (long) 1, (long) 8, (1) * sizeof(char),
276 ECPGt_NO_INDICATOR, NULL, 0L, 0L, 0L, ECPGt_EORT);
277 #line 74 "execute.pgc"
279 if (sqlca.sqlcode < 0)
282 #line 74 "execute.pgc"
285 for (i = 0, j = sqlca.sqlerrd[2]; i < j; i++)
287 /* exec sql begin declare section */
291 #line 79 "execute.pgc"
295 #line 80 "execute.pgc"
298 /* exec sql end declare section */
299 #line 81 "execute.pgc"
302 strncpy(n, name[i], 8);
303 printf("name[%d]=%8.8s\tamount[%d]=%d\tletter[%d]=%c\n", i, n, i, a, i, l);
307 ECPGdo(__LINE__, 0, 1, NULL, "close CUR2", ECPGt_EOIT, ECPGt_EORT);
308 #line 87 "execute.pgc"
310 if (sqlca.sqlcode < 0)
313 #line 87 "execute.pgc"
316 ECPGdo(__LINE__, 0, 1, NULL, "drop table test ", ECPGt_EOIT, ECPGt_EORT);
317 #line 88 "execute.pgc"
319 if (sqlca.sqlcode < 0)
322 #line 88 "execute.pgc"
325 ECPGtrans(__LINE__, NULL, "commit");
326 #line 89 "execute.pgc"
328 if (sqlca.sqlcode < 0)
331 #line 89 "execute.pgc"
334 ECPGdisconnect(__LINE__, "CURRENT");
335 #line 90 "execute.pgc"
337 if (sqlca.sqlcode < 0)
340 #line 90 "execute.pgc"