PostgreSQL Source Code: src/interfaces/ecpg/test/expected/preproc-array_of_struct.c Source File (original) (raw)
1
2
6
7#define ECPGdebug(X,Y) ECPGdebug((X)+100,(Y))
8
9#line 1 "array_of_struct.pgc"
10#include <stdio.h>
11
12
13#line 1 "regression.h"
14
15
16
17
18
19
20#line 3 "array_of_struct.pgc"
21
22
23
24#line 5 "array_of_struct.pgc"
25
26
27#line 6 "array_of_struct.pgc"
28
29
30#line 7 "array_of_struct.pgc"
31
32
33typedef struct {
34#line 12 "array_of_struct.pgc"
36
37#line 13 "array_of_struct.pgc"
40#line 14 "array_of_struct.pgc"
41
42
44#line 19 "array_of_struct.pgc"
46
47#line 20 "array_of_struct.pgc"
50#line 21 "array_of_struct.pgc"
51
52
54{
55
56
57
58
59
60
61
62 typedef struct {
63#line 30 "array_of_struct.pgc"
64 struct varchar_2 { int len; char arr[ 50 ]; } name ;
65
66#line 31 "array_of_struct.pgc"
67 int phone ;
68 } customer2 ;
69
70#line 32 "array_of_struct.pgc"
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86#line 26 "array_of_struct.pgc"
88
89#line 27 "array_of_struct.pgc"
91
92#line 33 "array_of_struct.pgc"
93 customer2 custs2 [ 10 ] ;
94
95#line 38 "array_of_struct.pgc"
96 struct customer3 {
97#line 36 "array_of_struct.pgc"
98 struct varchar_3 { int len; char arr[ 50 ]; } name ;
99
100#line 37 "array_of_struct.pgc"
101 int phone ;
102 } custs3 [ 10 ] ;
103
104#line 43 "array_of_struct.pgc"
105 struct customer4 {
106#line 41 "array_of_struct.pgc"
107 struct varchar_4 { int len; char arr[ 50 ]; } name ;
108
109#line 42 "array_of_struct.pgc"
110 int phone ;
111 } custs4 ;
112
113#line 44 "array_of_struct.pgc"
114 int r ;
115
116#line 45 "array_of_struct.pgc"
117 struct varchar_5 { int len; char arr[ 50 ]; } onlyname [ 2 ] ;
118
119#line 46 "array_of_struct.pgc"
120
121
123
124 { ECPGconnect(__LINE__, 0, "ecpg1_regression" , NULL, NULL , NULL, 0);
125#line 50 "array_of_struct.pgc"
126
128#line 50 "array_of_struct.pgc"
129
131#line 50 "array_of_struct.pgc"
132
133
135#line 52 "array_of_struct.pgc"
136
138#line 52 "array_of_struct.pgc"
139
141#line 52 "array_of_struct.pgc"
142
144#line 53 "array_of_struct.pgc"
145
147#line 53 "array_of_struct.pgc"
148
150#line 53 "array_of_struct.pgc"
151
153#line 53 "array_of_struct.pgc"
154
156#line 54 "array_of_struct.pgc"
157
159#line 54 "array_of_struct.pgc"
160
162#line 54 "array_of_struct.pgc"
163
165#line 54 "array_of_struct.pgc"
166
167
173#line 56 "array_of_struct.pgc"
174
176#line 56 "array_of_struct.pgc"
177
179#line 56 "array_of_struct.pgc"
180
182#line 56 "array_of_struct.pgc"
183
185 for (r = 0; r < 2; r++)
186 {
187 printf( "name - %s\n", custs1[r].name.arr );
188 printf( "phone - %d\n", custs1[r].phone );
189 }
190
192 ECPGt_varchar,&(custs2->name),(long)50,(long)10,sizeof( customer2 ),
194 ECPGt_int,&(custs2->phone),(long)1,(long)10,sizeof( customer2 ),
196#line 64 "array_of_struct.pgc"
197
199#line 64 "array_of_struct.pgc"
200
202#line 64 "array_of_struct.pgc"
203
205#line 64 "array_of_struct.pgc"
206
207 printf("\ncusts2:\n");
208 for (r = 0; r < 2; r++)
209 {
210 printf( "name - %s\n", custs2[r].name.arr );
211 printf( "phone - %d\n", custs2[r].phone );
212 }
213
215 ECPGt_varchar,&(custs3->name),(long)50,(long)10,sizeof( struct customer3 ),
217 ECPGt_int,&(custs3->phone),(long)1,(long)10,sizeof( struct customer3 ),
219#line 72 "array_of_struct.pgc"
220
222#line 72 "array_of_struct.pgc"
223
225#line 72 "array_of_struct.pgc"
226
228#line 72 "array_of_struct.pgc"
229
230 printf("\ncusts3:\n");
231 for (r = 0; r < 2; r++)
232 {
233 printf( "name - %s\n", custs3[r].name.arr );
234 printf( "phone - %d\n", custs3[r].phone );
235 }
236
238 ECPGt_varchar,&(custs4.name),(long)50,(long)1,sizeof( struct customer4 ),
240 ECPGt_int,&(custs4.phone),(long)1,(long)1,sizeof( struct customer4 ),
242#line 80 "array_of_struct.pgc"
243
245#line 80 "array_of_struct.pgc"
246
248#line 80 "array_of_struct.pgc"
249
251#line 80 "array_of_struct.pgc"
252
253 printf("\ncusts4:\n");
254 printf( "name - %s\n", custs4.name.arr );
255 printf( "phone - %d\n", custs4.phone );
256
258 ECPGt_varchar,(onlyname),(long)50,(long)2,sizeof(struct varchar_5),
260#line 85 "array_of_struct.pgc"
261
263#line 85 "array_of_struct.pgc"
264
266#line 85 "array_of_struct.pgc"
267
269#line 85 "array_of_struct.pgc"
270
272 for (r = 0; r < 2; r++)
273 {
274 printf( "name - %s\n", onlyname[r].arr );
275 }
276
278#line 92 "array_of_struct.pgc"
279
281#line 92 "array_of_struct.pgc"
282
284#line 92 "array_of_struct.pgc"
285
286
287 return 0;
288}
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