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))
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"
47
char name [ 8 ] [ 8 ] ;
49
#line 17 "execute.pgc"
50
char letter [ 8 ] [ 1 ] ;
52
#line 18 "execute.pgc"
53
char command [ 128 ] ;
54
/* exec sql end declare section */
55
#line 19 "execute.pgc"
61
{ ECPGconnect(__LINE__, 0, "regress1" , NULL, NULL , "main", 0);
62
#line 24 "execute.pgc"
64
if (sqlca.sqlcode < 0) sqlprint();}
65
#line 24 "execute.pgc"
67
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "create table test ( name char ( 8 ) , amount int , letter char ( 1 ) )", ECPGt_EOIT, ECPGt_EORT);
68
#line 25 "execute.pgc"
70
if (sqlca.sqlcode < 0) sqlprint();}
71
#line 25 "execute.pgc"
73
{ ECPGtrans(__LINE__, NULL, "commit");
74
#line 26 "execute.pgc"
76
if (sqlca.sqlcode < 0) sqlprint();}
77
#line 26 "execute.pgc"
80
sprintf(command, "insert into test (name, amount, letter) values ('db: ''r1''', 1, 'f')");
81
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_exec_immediate, command, ECPGt_EOIT, ECPGt_EORT);
82
#line 29 "execute.pgc"
84
if (sqlca.sqlcode < 0) sqlprint();}
85
#line 29 "execute.pgc"
88
sprintf(command, "insert into test (name, amount, letter) values ('db: ''r1''', 2, 't')");
89
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_exec_immediate, command, ECPGt_EOIT, ECPGt_EORT);
90
#line 32 "execute.pgc"
92
if (sqlca.sqlcode < 0) sqlprint();}
93
#line 32 "execute.pgc"
96
sprintf(command, "insert into test (name, amount, letter) select name, amount+10, letter from test");
97
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_exec_immediate, command, ECPGt_EOIT, ECPGt_EORT);
98
#line 35 "execute.pgc"
100
if (sqlca.sqlcode < 0) sqlprint();}
101
#line 35 "execute.pgc"
104
printf("Inserted %ld tuples via execute immediate\n", sqlca.sqlerrd[2]);
106
sprintf(command, "insert into test (name, amount, letter) select name, amount+$1, letter from test");
107
{ ECPGprepare(__LINE__, NULL, 0, "i", command);
108
#line 40 "execute.pgc"
110
if (sqlca.sqlcode < 0) sqlprint();}
111
#line 40 "execute.pgc"
113
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_execute, "i",
114
ECPGt_int,&(increment),(long)1,(long)1,sizeof(int),
115
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
116
#line 41 "execute.pgc"
118
if (sqlca.sqlcode < 0) sqlprint();}
119
#line 41 "execute.pgc"
122
printf("Inserted %ld tuples via prepared execute\n", sqlca.sqlerrd[2]);
124
{ ECPGtrans(__LINE__, NULL, "commit");
125
#line 45 "execute.pgc"
127
if (sqlca.sqlcode < 0) sqlprint();}
128
#line 45 "execute.pgc"
131
sprintf (command, "select * from test");
133
{ ECPGprepare(__LINE__, NULL, 0, "f", command);
134
#line 49 "execute.pgc"
136
if (sqlca.sqlcode < 0) sqlprint();}
137
#line 49 "execute.pgc"
139
/* declare CUR cursor for $1 */
140
#line 50 "execute.pgc"
143
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare CUR cursor for $1",
144
ECPGt_char_variable,(ECPGprepared_statement(NULL, "f", __LINE__)),(long)1,(long)1,(1)*sizeof(char),
145
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
146
#line 52 "execute.pgc"
148
if (sqlca.sqlcode < 0) sqlprint();}
149
#line 52 "execute.pgc"
151
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch 8 in CUR", ECPGt_EOIT,
152
ECPGt_char,(name),(long)8,(long)8,(8)*sizeof(char),
153
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
154
ECPGt_int,(amount),(long)1,(long)8,sizeof(int),
155
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
156
ECPGt_char,(letter),(long)1,(long)8,(1)*sizeof(char),
157
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
158
#line 53 "execute.pgc"
160
if (sqlca.sqlcode < 0) sqlprint();}
161
#line 53 "execute.pgc"
164
for (i=0, j=sqlca.sqlerrd[2]; i<j; i++)
166
/* exec sql begin declare section */
170
#line 58 "execute.pgc"
171
char n [ 8 ] , l = letter [ i ] [ 0 ] ;
173
#line 59 "execute.pgc"
174
int a = amount [ i ] ;
175
/* exec sql end declare section */
176
#line 60 "execute.pgc"
179
strncpy(n, name[i], 8);
180
printf("name[%d]=%8.8s\tamount[%d]=%d\tletter[%d]=%c\n", i, n, i, a, i, l);
183
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close CUR", ECPGt_EOIT, ECPGt_EORT);
184
#line 66 "execute.pgc"
186
if (sqlca.sqlcode < 0) sqlprint();}
187
#line 66 "execute.pgc"
189
{ ECPGdeallocate(__LINE__, 0, NULL, "f");
190
#line 67 "execute.pgc"
192
if (sqlca.sqlcode < 0) sqlprint();}
193
#line 67 "execute.pgc"
196
sprintf (command, "select * from test where amount = $1");
198
{ ECPGprepare(__LINE__, NULL, 0, "f", command);
199
#line 71 "execute.pgc"
201
if (sqlca.sqlcode < 0) sqlprint();}
202
#line 71 "execute.pgc"
204
/* declare CUR2 cursor for $1 */
205
#line 72 "execute.pgc"
208
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare CUR2 cursor for $1",
209
ECPGt_char_variable,(ECPGprepared_statement(NULL, "f", __LINE__)),(long)1,(long)1,(1)*sizeof(char),
210
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
211
ECPGt_const,"1",(long)1,(long)1,strlen("1"),
212
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
213
#line 74 "execute.pgc"
215
if (sqlca.sqlcode < 0) sqlprint();}
216
#line 74 "execute.pgc"
218
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch in CUR2", ECPGt_EOIT,
219
ECPGt_char,(name),(long)8,(long)8,(8)*sizeof(char),
220
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
221
ECPGt_int,(amount),(long)1,(long)8,sizeof(int),
222
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
223
ECPGt_char,(letter),(long)1,(long)8,(1)*sizeof(char),
224
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
225
#line 75 "execute.pgc"
227
if (sqlca.sqlcode < 0) sqlprint();}
228
#line 75 "execute.pgc"
231
for (i=0, j=sqlca.sqlerrd[2]; i<j; i++)
233
/* exec sql begin declare section */
237
#line 80 "execute.pgc"
238
char n [ 8 ] , l = letter [ i ] [ 0 ] ;
240
#line 81 "execute.pgc"
241
int a = amount [ i ] ;
242
/* exec sql end declare section */
243
#line 82 "execute.pgc"
246
strncpy(n, name[i], 8);
247
printf("name[%d]=%8.8s\tamount[%d]=%d\tletter[%d]=%c\n", i, n, i, a, i, l);
250
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close CUR2", ECPGt_EOIT, ECPGt_EORT);
251
#line 88 "execute.pgc"
253
if (sqlca.sqlcode < 0) sqlprint();}
254
#line 88 "execute.pgc"
256
{ ECPGdeallocate(__LINE__, 0, NULL, "f");
257
#line 89 "execute.pgc"
259
if (sqlca.sqlcode < 0) sqlprint();}
260
#line 89 "execute.pgc"
263
sprintf (command, "select * from test where amount = $1");
265
{ ECPGprepare(__LINE__, NULL, 0, "f", command);
266
#line 93 "execute.pgc"
268
if (sqlca.sqlcode < 0) sqlprint();}
269
#line 93 "execute.pgc"
271
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_execute, "f",
272
ECPGt_const,"2",(long)1,(long)1,strlen("2"),
273
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT,
274
ECPGt_char,(name),(long)8,(long)8,(8)*sizeof(char),
275
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
276
ECPGt_int,(amount),(long)1,(long)8,sizeof(int),
277
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
278
ECPGt_char,(letter),(long)1,(long)8,(1)*sizeof(char),
279
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
280
#line 94 "execute.pgc"
282
if (sqlca.sqlcode < 0) sqlprint();}
283
#line 94 "execute.pgc"
286
for (i=0, j=sqlca.sqlerrd[2]; i<j; i++)
288
/* exec sql begin declare section */
292
#line 99 "execute.pgc"
293
char n [ 8 ] , l = letter [ i ] [ 0 ] ;
295
#line 100 "execute.pgc"
296
int a = amount [ i ] ;
297
/* exec sql end declare section */
298
#line 101 "execute.pgc"
301
strncpy(n, name[i], 8);
302
printf("name[%d]=%8.8s\tamount[%d]=%d\tletter[%d]=%c\n", i, n, i, a, i, l);
305
{ ECPGdeallocate(__LINE__, 0, NULL, "f");
306
#line 107 "execute.pgc"
308
if (sqlca.sqlcode < 0) sqlprint();}
309
#line 107 "execute.pgc"
311
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "drop table test", ECPGt_EOIT, ECPGt_EORT);
312
#line 108 "execute.pgc"
314
if (sqlca.sqlcode < 0) sqlprint();}
315
#line 108 "execute.pgc"
317
{ ECPGtrans(__LINE__, NULL, "commit");
318
#line 109 "execute.pgc"
320
if (sqlca.sqlcode < 0) sqlprint();}
321
#line 109 "execute.pgc"
323
{ ECPGdisconnect(__LINE__, "CURRENT");
324
#line 110 "execute.pgc"
326
if (sqlca.sqlcode < 0) sqlprint();}
327
#line 110 "execute.pgc"