61{
62
63
64
65
66
67
68
69 typedef struct {
70#line 36 "array_of_struct.pgc"
71 struct varchar_2 {
int len;
char arr[ 50 ]; }
name ;
72
73#line 37 "array_of_struct.pgc"
74 int phone ;
75 } customer2 ;
76
77#line 38 "array_of_struct.pgc"
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96#line 32 "array_of_struct.pgc"
98
99#line 33 "array_of_struct.pgc"
101
102#line 39 "array_of_struct.pgc"
103 customer2 custs2 [ 10 ] ;
104
105#line 44 "array_of_struct.pgc"
106 struct customer3 {
107#line 42 "array_of_struct.pgc"
108 struct varchar_3 {
int len;
char arr[ 50 ]; }
name ;
109
110#line 43 "array_of_struct.pgc"
111 int phone ;
112 } custs3 [ 10 ] ;
113
114#line 49 "array_of_struct.pgc"
115 struct customer4 {
116#line 47 "array_of_struct.pgc"
117 struct varchar_4 {
int len;
char arr[ 50 ]; }
name ;
118
119#line 48 "array_of_struct.pgc"
120 int phone ;
121 } custs4 ;
122
123#line 51 "array_of_struct.pgc"
125
126#line 53 "array_of_struct.pgc"
127 int r ;
128
129#line 54 "array_of_struct.pgc"
130 struct varchar_5 {
int len;
char arr[ 50 ]; } onlyname [ 2 ] ;
131
132#line 55 "array_of_struct.pgc"
133
134
136
137 {
ECPGconnect(__LINE__, 0,
"ecpg1_regression" , NULL, NULL , NULL, 0);
138#line 59 "array_of_struct.pgc"
139
141#line 59 "array_of_struct.pgc"
142
144#line 59 "array_of_struct.pgc"
145
146
148#line 61 "array_of_struct.pgc"
149
151#line 61 "array_of_struct.pgc"
152
154#line 61 "array_of_struct.pgc"
155
156
157
158 strcpy(custs1[0].
name.arr,
"John Doe");
160 custs1[0].
phone = 12345;
161
165
166 {
ECPGdo(__LINE__, 0, 1, NULL, 0,
ECPGst_normal,
"insert into customers values ( $1 , $2 )",
169 ECPGt_int,&(custs1[0].phone),(
long)1,(
long)1,
sizeof(
int),
171#line 73 "array_of_struct.pgc"
172
174#line 73 "array_of_struct.pgc"
175
177#line 73 "array_of_struct.pgc"
178
180#line 73 "array_of_struct.pgc"
181
182 {
ECPGdo(__LINE__, 0, 1, NULL, 0,
ECPGst_normal,
"insert into customers values ( $1 , $2 )",
187#line 75 "array_of_struct.pgc"
188
190#line 75 "array_of_struct.pgc"
191
193#line 75 "array_of_struct.pgc"
194
196#line 75 "array_of_struct.pgc"
197
198
199
200 memset(custs1, 0,
sizeof(
customer) * 10);
201
202
208#line 81 "array_of_struct.pgc"
209
211#line 81 "array_of_struct.pgc"
212
214#line 81 "array_of_struct.pgc"
215
217#line 81 "array_of_struct.pgc"
218
220 for (r = 0; r < 2; r++)
221 {
223 printf(
"phone - %d\n", custs1[r].phone );
224 }
225
227 ECPGt_varchar,&(custs2->name),(
long)50,(
long)10,
sizeof( customer2 ),
229 ECPGt_int,&(custs2->phone),(
long)1,(
long)10,
sizeof( customer2 ),
231#line 89 "array_of_struct.pgc"
232
234#line 89 "array_of_struct.pgc"
235
237#line 89 "array_of_struct.pgc"
238
240#line 89 "array_of_struct.pgc"
241
243 for (r = 0; r < 2; r++)
244 {
246 printf(
"phone - %d\n", custs2[r].phone );
247 }
248
250 ECPGt_varchar,&(custs3->name),(
long)50,(
long)10,
sizeof(
struct customer3 ),
252 ECPGt_int,&(custs3->phone),(
long)1,(
long)10,
sizeof(
struct customer3 ),
254#line 97 "array_of_struct.pgc"
255
257#line 97 "array_of_struct.pgc"
258
260#line 97 "array_of_struct.pgc"
261
263#line 97 "array_of_struct.pgc"
264
266 for (r = 0; r < 2; r++)
267 {
269 printf(
"phone - %d\n", custs3[r].phone );
270 }
271
273 ECPGt_varchar,&(custs4.name),(
long)50,(
long)1,
sizeof(
struct customer4 ),
274 ECPGt_short,&(inds[0].name_ind),(
long)1,(
long)1,
sizeof(
struct ind ),
275 ECPGt_int,&(custs4.phone),(
long)1,(
long)1,
sizeof(
struct customer4 ),
277#line 105 "array_of_struct.pgc"
278
280#line 105 "array_of_struct.pgc"
281
283#line 105 "array_of_struct.pgc"
284
286#line 105 "array_of_struct.pgc"
287
289 printf(
"name - %s\n", custs4.name.arr );
290 printf(
"phone - %d\n", custs4.phone );
291
293 ECPGt_varchar,(onlyname),(
long)50,(
long)2,
sizeof(
struct varchar_5),
295#line 110 "array_of_struct.pgc"
296
298#line 110 "array_of_struct.pgc"
299
301#line 110 "array_of_struct.pgc"
302
304#line 110 "array_of_struct.pgc"
305
307 for (r = 0; r < 2; r++)
308 {
309 printf(
"name - %s\n", onlyname[r].arr );
310 }
311
313#line 117 "array_of_struct.pgc"
314
316#line 117 "array_of_struct.pgc"
317
319#line 117 "array_of_struct.pgc"
320
321
322 return 0;
323}
bool ECPGdisconnect(int lineno, const char *connection_name)
bool ECPGconnect(int lineno, int c, const char *name, const char *user, const char *passwd, const char *connection_name, int autocommit)
bool ECPGdo(const int lineno, const int compat, const int force_indicator, const char *connection_name, const bool questionmarks, const int st, const char *query,...)
struct customer::varchar_1 name