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))
9
#line 1 "array_of_struct.pgc"
13
#line 1 "regression.h"
20
#line 3 "array_of_struct.pgc"
23
/* exec sql whenever sqlerror sqlprint ; */
24
#line 5 "array_of_struct.pgc"
26
/* exec sql whenever sql_warning sqlprint ; */
27
#line 6 "array_of_struct.pgc"
29
/* exec sql whenever not found sqlprint ; */
30
#line 7 "array_of_struct.pgc"
34
#line 12 "array_of_struct.pgc"
35
struct varchar_name_12 { int len; char arr[ 50 ]; } name ;
37
#line 13 "array_of_struct.pgc"
40
#line 14 "array_of_struct.pgc"
44
#line 19 "array_of_struct.pgc"
47
#line 20 "array_of_struct.pgc"
50
#line 21 "array_of_struct.pgc"
53
int main( int argc, char * argv[] )
55
/* exec sql begin declare section */
63
#line 30 "array_of_struct.pgc"
64
struct varchar_name_30 { int len; char arr[ 50 ]; } name ;
66
#line 31 "array_of_struct.pgc"
70
#line 32 "array_of_struct.pgc"
86
#line 26 "array_of_struct.pgc"
87
customer custs1 [ 10 ] ;
89
#line 27 "array_of_struct.pgc"
90
cust_ind inds [ 10 ] ;
92
#line 33 "array_of_struct.pgc"
93
customer2 custs2 [ 10 ] ;
95
#line 38 "array_of_struct.pgc"
97
#line 36 "array_of_struct.pgc"
98
struct varchar_name_36 { int len; char arr[ 50 ]; } name ;
100
#line 37 "array_of_struct.pgc"
104
#line 43 "array_of_struct.pgc"
106
#line 41 "array_of_struct.pgc"
107
struct varchar_name_41 { int len; char arr[ 50 ]; } name ;
109
#line 42 "array_of_struct.pgc"
113
#line 44 "array_of_struct.pgc"
116
#line 45 "array_of_struct.pgc"
117
struct varchar_onlyname_45 { int len; char arr[ 50 ]; } onlyname [2] ;
118
/* exec sql end declare section */
119
#line 46 "array_of_struct.pgc"
122
ECPGdebug(1, stderr);
124
{ ECPGconnect(__LINE__, 0, "regress1" , NULL, NULL , NULL, 0);
125
#line 50 "array_of_struct.pgc"
127
if (sqlca.sqlwarn[0] == 'W') sqlprint();
128
#line 50 "array_of_struct.pgc"
130
if (sqlca.sqlcode < 0) sqlprint();}
131
#line 50 "array_of_struct.pgc"
134
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "create table customers ( c varchar ( 50 ) , p int )", ECPGt_EOIT, ECPGt_EORT);
135
#line 52 "array_of_struct.pgc"
137
if (sqlca.sqlwarn[0] == 'W') sqlprint();
138
#line 52 "array_of_struct.pgc"
140
if (sqlca.sqlcode < 0) sqlprint();}
141
#line 52 "array_of_struct.pgc"
143
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "insert into customers values ( 'John Doe' , '12345' )", ECPGt_EOIT, ECPGt_EORT);
144
#line 53 "array_of_struct.pgc"
146
if (sqlca.sqlcode == ECPG_NOT_FOUND) sqlprint();
147
#line 53 "array_of_struct.pgc"
149
if (sqlca.sqlwarn[0] == 'W') sqlprint();
150
#line 53 "array_of_struct.pgc"
152
if (sqlca.sqlcode < 0) sqlprint();}
153
#line 53 "array_of_struct.pgc"
155
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "insert into customers values ( 'Jane Doe' , '67890' )", ECPGt_EOIT, ECPGt_EORT);
156
#line 54 "array_of_struct.pgc"
158
if (sqlca.sqlcode == ECPG_NOT_FOUND) sqlprint();
159
#line 54 "array_of_struct.pgc"
161
if (sqlca.sqlwarn[0] == 'W') sqlprint();
162
#line 54 "array_of_struct.pgc"
164
if (sqlca.sqlcode < 0) sqlprint();}
165
#line 54 "array_of_struct.pgc"
168
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select * from customers limit 2", ECPGt_EOIT,
169
ECPGt_varchar,&(custs1->name),(long)50,(long)10,sizeof( customer ),
170
ECPGt_short,&(inds->name_ind),(long)1,(long)10,sizeof( struct ind ),
171
ECPGt_int,&(custs1->phone),(long)1,(long)10,sizeof( customer ),
172
ECPGt_short,&(inds->phone_ind),(long)1,(long)10,sizeof( struct ind ), ECPGt_EORT);
173
#line 56 "array_of_struct.pgc"
175
if (sqlca.sqlcode == ECPG_NOT_FOUND) sqlprint();
176
#line 56 "array_of_struct.pgc"
178
if (sqlca.sqlwarn[0] == 'W') sqlprint();
179
#line 56 "array_of_struct.pgc"
181
if (sqlca.sqlcode < 0) sqlprint();}
182
#line 56 "array_of_struct.pgc"
185
for (r = 0; r < 2; r++)
187
printf( "name - %s\n", custs1[r].name.arr );
188
printf( "phone - %d\n", custs1[r].phone );
191
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select * from customers limit 2", ECPGt_EOIT,
192
ECPGt_varchar,&(custs2->name),(long)50,(long)10,sizeof( customer2 ),
193
ECPGt_short,&(inds->name_ind),(long)1,(long)10,sizeof( struct ind ),
194
ECPGt_int,&(custs2->phone),(long)1,(long)10,sizeof( customer2 ),
195
ECPGt_short,&(inds->phone_ind),(long)1,(long)10,sizeof( struct ind ), ECPGt_EORT);
196
#line 64 "array_of_struct.pgc"
198
if (sqlca.sqlcode == ECPG_NOT_FOUND) sqlprint();
199
#line 64 "array_of_struct.pgc"
201
if (sqlca.sqlwarn[0] == 'W') sqlprint();
202
#line 64 "array_of_struct.pgc"
204
if (sqlca.sqlcode < 0) sqlprint();}
205
#line 64 "array_of_struct.pgc"
207
printf("\ncusts2:\n");
208
for (r = 0; r < 2; r++)
210
printf( "name - %s\n", custs2[r].name.arr );
211
printf( "phone - %d\n", custs2[r].phone );
214
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select * from customers limit 2", ECPGt_EOIT,
215
ECPGt_varchar,&(custs3->name),(long)50,(long)10,sizeof( struct customer3 ),
216
ECPGt_short,&(inds->name_ind),(long)1,(long)10,sizeof( struct ind ),
217
ECPGt_int,&(custs3->phone),(long)1,(long)10,sizeof( struct customer3 ),
218
ECPGt_short,&(inds->phone_ind),(long)1,(long)10,sizeof( struct ind ), ECPGt_EORT);
219
#line 72 "array_of_struct.pgc"
221
if (sqlca.sqlcode == ECPG_NOT_FOUND) sqlprint();
222
#line 72 "array_of_struct.pgc"
224
if (sqlca.sqlwarn[0] == 'W') sqlprint();
225
#line 72 "array_of_struct.pgc"
227
if (sqlca.sqlcode < 0) sqlprint();}
228
#line 72 "array_of_struct.pgc"
230
printf("\ncusts3:\n");
231
for (r = 0; r < 2; r++)
233
printf( "name - %s\n", custs3[r].name.arr );
234
printf( "phone - %d\n", custs3[r].phone );
237
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select * from customers limit 1", ECPGt_EOIT,
238
ECPGt_varchar,&(custs4.name),(long)50,(long)1,sizeof(struct varchar_name_41),
239
ECPGt_short,&(inds[0].name_ind),(long)1,(long)1,sizeof(short),
240
ECPGt_int,&(custs4.phone),(long)1,(long)1,sizeof(int),
241
ECPGt_short,&(inds[0].phone_ind),(long)1,(long)1,sizeof(short), ECPGt_EORT);
242
#line 80 "array_of_struct.pgc"
244
if (sqlca.sqlcode == ECPG_NOT_FOUND) sqlprint();
245
#line 80 "array_of_struct.pgc"
247
if (sqlca.sqlwarn[0] == 'W') sqlprint();
248
#line 80 "array_of_struct.pgc"
250
if (sqlca.sqlcode < 0) sqlprint();}
251
#line 80 "array_of_struct.pgc"
253
printf("\ncusts4:\n");
254
printf( "name - %s\n", custs4.name.arr );
255
printf( "phone - %d\n", custs4.phone );
257
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select c from customers limit 2", ECPGt_EOIT,
258
ECPGt_varchar,(onlyname),(long)50,(long)2,sizeof(struct varchar_onlyname_45),
259
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
260
#line 85 "array_of_struct.pgc"
262
if (sqlca.sqlcode == ECPG_NOT_FOUND) sqlprint();
263
#line 85 "array_of_struct.pgc"
265
if (sqlca.sqlwarn[0] == 'W') sqlprint();
266
#line 85 "array_of_struct.pgc"
268
if (sqlca.sqlcode < 0) sqlprint();}
269
#line 85 "array_of_struct.pgc"
272
for (r = 0; r < 2; r++)
274
printf( "name - %s\n", onlyname[r].arr );
277
{ ECPGdisconnect(__LINE__, "ALL");
278
#line 92 "array_of_struct.pgc"
280
if (sqlca.sqlwarn[0] == 'W') sqlprint();
281
#line 92 "array_of_struct.pgc"
283
if (sqlca.sqlcode < 0) sqlprint();}
284
#line 92 "array_of_struct.pgc"