62{
63
64
65
66
67
68
69
70 typedef struct {
71#line 37 "pointer_to_struct.pgc"
72 struct varchar_2 {
int len;
char arr[ 50 ]; }
name ;
73
74#line 38 "pointer_to_struct.pgc"
75 int phone ;
76 } customer2 ;
77
78#line 39 "pointer_to_struct.pgc"
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99#line 33 "pointer_to_struct.pgc"
101
102#line 34 "pointer_to_struct.pgc"
104
105#line 40 "pointer_to_struct.pgc"
106 customer2 * custs2 = ( customer2 * )
malloc (
sizeof ( customer2 ) * 10 ) ;
107
108#line 46 "pointer_to_struct.pgc"
109 struct customer3 {
110#line 44 "pointer_to_struct.pgc"
112
113#line 45 "pointer_to_struct.pgc"
114 int phone ;
115 } * custs3 = (
struct customer3 * )
malloc (
sizeof (
struct customer3 ) * 10 ) ;
116
117#line 52 "pointer_to_struct.pgc"
118 struct customer4 {
119#line 50 "pointer_to_struct.pgc"
120 struct varchar_3 {
int len;
char arr[ 50 ]; }
name ;
121
122#line 51 "pointer_to_struct.pgc"
123 int phone ;
124 } * custs4 = (
struct customer4 * )
malloc (
sizeof (
struct customer4 ) ) ;
125
126#line 54 "pointer_to_struct.pgc"
128
129#line 56 "pointer_to_struct.pgc"
130 int r ;
131
132#line 57 "pointer_to_struct.pgc"
133 struct varchar_4 {
int len;
char arr[ 50 ]; } onlyname [ 2 ] ;
134
135#line 58 "pointer_to_struct.pgc"
136
137
139
141
142 {
ECPGconnect(__LINE__, 0,
"ecpg1_regression" , NULL, NULL , NULL, 0);
143#line 64 "pointer_to_struct.pgc"
144
146#line 64 "pointer_to_struct.pgc"
147
149#line 64 "pointer_to_struct.pgc"
150
151
153#line 66 "pointer_to_struct.pgc"
154
156#line 66 "pointer_to_struct.pgc"
157
159#line 66 "pointer_to_struct.pgc"
160
161
162
163 strcpy(custs1[0].
name.arr,
"John Doe");
165 custs1[0].
phone = 12345;
166
170
171 {
ECPGdo(__LINE__, 0, 1, NULL, 0,
ECPGst_normal,
"insert into customers values ( $1 , $2 )",
174 ECPGt_int,&(custs1[0].phone),(
long)1,(
long)1,
sizeof(
int),
176#line 78 "pointer_to_struct.pgc"
177
179#line 78 "pointer_to_struct.pgc"
180
182#line 78 "pointer_to_struct.pgc"
183
185#line 78 "pointer_to_struct.pgc"
186
187 {
ECPGdo(__LINE__, 0, 1, NULL, 0,
ECPGst_normal,
"insert into customers values ( $1 , $2 )",
192#line 80 "pointer_to_struct.pgc"
193
195#line 80 "pointer_to_struct.pgc"
196
198#line 80 "pointer_to_struct.pgc"
199
201#line 80 "pointer_to_struct.pgc"
202
203
204
205 memset(custs1, 0,
sizeof(
customer) * 10);
206
207
213#line 86 "pointer_to_struct.pgc"
214
216#line 86 "pointer_to_struct.pgc"
217
219#line 86 "pointer_to_struct.pgc"
220
222#line 86 "pointer_to_struct.pgc"
223
225 for (r = 0; r < 2; r++)
226 {
228 printf(
"phone - %d\n", custs1[r].phone );
229 }
230
232 ECPGt_varchar,&(custs2->name),(
long)50,(
long)-1,
sizeof( customer2 ),
234 ECPGt_int,&(custs2->phone),(
long)1,(
long)-1,
sizeof( customer2 ),
236#line 94 "pointer_to_struct.pgc"
237
239#line 94 "pointer_to_struct.pgc"
240
242#line 94 "pointer_to_struct.pgc"
243
245#line 94 "pointer_to_struct.pgc"
246
248 for (r = 0; r < 2; r++)
249 {
251 printf(
"phone - %d\n", custs2[r].phone );
252 }
253
255 ECPGt_char,&(custs3->name),(
long)50,(
long)-1,
sizeof(
struct customer3 ),
257 ECPGt_int,&(custs3->phone),(
long)1,(
long)-1,
sizeof(
struct customer3 ),
259#line 102 "pointer_to_struct.pgc"
260
262#line 102 "pointer_to_struct.pgc"
263
265#line 102 "pointer_to_struct.pgc"
266
268#line 102 "pointer_to_struct.pgc"
269
271 for (r = 0; r < 2; r++)
272 {
274 printf(
"phone - %d\n", custs3[r].phone );
275 }
276
278 ECPGt_varchar,&(custs4->name),(
long)50,(
long)-1,
sizeof(
struct customer4 ),
280 ECPGt_int,&(custs4->phone),(
long)1,(
long)-1,
sizeof(
struct customer4 ),
282#line 110 "pointer_to_struct.pgc"
283
285#line 110 "pointer_to_struct.pgc"
286
288#line 110 "pointer_to_struct.pgc"
289
291#line 110 "pointer_to_struct.pgc"
292
294 printf(
"name - %s\n", custs4->name.arr );
295 printf(
"phone - %d\n", custs4->phone );
296
298 ECPGt_varchar,(onlyname),(
long)50,(
long)2,
sizeof(
struct varchar_4),
300#line 115 "pointer_to_struct.pgc"
301
303#line 115 "pointer_to_struct.pgc"
304
306#line 115 "pointer_to_struct.pgc"
307
309#line 115 "pointer_to_struct.pgc"
310
312 for (r = 0; r < 2; r++)
313 {
314 printf(
"name - %s\n", onlyname[r].arr );
315 }
316
318#line 122 "pointer_to_struct.pgc"
319
321#line 122 "pointer_to_struct.pgc"
322
324#line 122 "pointer_to_struct.pgc"
325
326
327
328 return 0;
329}
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