@@ -81,6 +81,7 @@ int main( int argc, char * argv[] )
81
81
82
82
83
83
84
+
84
85
85
86
#line 26 "array_of_struct.pgc"
86
87
customer custs1 [ 10 ] ;
@@ -111,71 +112,74 @@ int main( int argc, char * argv[] )
111
112
112
113
#line 44 "array_of_struct.pgc"
113
114
int r ;
114
- /* exec sql end declare section */
115
+
115
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"
116
120
117
121
118
122
ECPGdebug (1 , stderr );
119
123
120
124
{ ECPGconnect (__LINE__ , 0 , "regress1" , NULL , NULL , NULL , 0 );
121
- #line 49 "array_of_struct.pgc"
125
+ #line 50 "array_of_struct.pgc"
122
126
123
127
if (sqlca .sqlwarn [0 ] == 'W' ) sqlprint ();
124
- #line 49 "array_of_struct.pgc"
128
+ #line 50 "array_of_struct.pgc"
125
129
126
130
if (sqlca .sqlcode < 0 ) sqlprint ();}
127
- #line 49 "array_of_struct.pgc"
131
+ #line 50 "array_of_struct.pgc"
128
132
129
133
130
134
{ ECPGdo (__LINE__ , 0 , 1 , NULL , 0 , ECPGst_normal , "create table customers ( c varchar ( 50 ) , p int ) " , ECPGt_EOIT , ECPGt_EORT );
131
- #line 51 "array_of_struct.pgc"
135
+ #line 52 "array_of_struct.pgc"
132
136
133
137
if (sqlca .sqlwarn [0 ] == 'W' ) sqlprint ();
134
- #line 51 "array_of_struct.pgc"
138
+ #line 52 "array_of_struct.pgc"
135
139
136
140
if (sqlca .sqlcode < 0 ) sqlprint ();}
137
- #line 51 "array_of_struct.pgc"
141
+ #line 52 "array_of_struct.pgc"
138
142
139
143
{ ECPGdo (__LINE__ , 0 , 1 , NULL , 0 , ECPGst_normal , "insert into customers values ( 'John Doe' , '12345' ) " , ECPGt_EOIT , ECPGt_EORT );
140
- #line 52 "array_of_struct.pgc"
144
+ #line 53 "array_of_struct.pgc"
141
145
142
146
if (sqlca .sqlcode == ECPG_NOT_FOUND ) sqlprint ();
143
- #line 52 "array_of_struct.pgc"
147
+ #line 53 "array_of_struct.pgc"
144
148
145
149
if (sqlca .sqlwarn [0 ] == 'W' ) sqlprint ();
146
- #line 52 "array_of_struct.pgc"
150
+ #line 53 "array_of_struct.pgc"
147
151
148
152
if (sqlca .sqlcode < 0 ) sqlprint ();}
149
- #line 52 "array_of_struct.pgc"
153
+ #line 53 "array_of_struct.pgc"
150
154
151
155
{ ECPGdo (__LINE__ , 0 , 1 , NULL , 0 , ECPGst_normal , "insert into customers values ( 'Jane Doe' , '67890' ) " , ECPGt_EOIT , ECPGt_EORT );
152
- #line 53 "array_of_struct.pgc"
156
+ #line 54 "array_of_struct.pgc"
153
157
154
158
if (sqlca .sqlcode == ECPG_NOT_FOUND ) sqlprint ();
155
- #line 53 "array_of_struct.pgc"
159
+ #line 54 "array_of_struct.pgc"
156
160
157
161
if (sqlca .sqlwarn [0 ] == 'W' ) sqlprint ();
158
- #line 53 "array_of_struct.pgc"
162
+ #line 54 "array_of_struct.pgc"
159
163
160
164
if (sqlca .sqlcode < 0 ) sqlprint ();}
161
- #line 53 "array_of_struct.pgc"
165
+ #line 54 "array_of_struct.pgc"
162
166
163
167
164
168
{ ECPGdo (__LINE__ , 0 , 1 , NULL , 0 , ECPGst_normal , "select * from customers limit 2 " , ECPGt_EOIT ,
165
169
ECPGt_varchar ,& (custs1 -> name ),(long )50 ,(long )10 ,sizeof ( customer ),
166
170
ECPGt_short ,& (inds -> name_ind ),(long )1 ,(long )10 ,sizeof ( struct ind ),
167
171
ECPGt_int ,& (custs1 -> phone ),(long )1 ,(long )10 ,sizeof ( customer ),
168
172
ECPGt_short ,& (inds -> phone_ind ),(long )1 ,(long )10 ,sizeof ( struct ind ), ECPGt_EORT );
169
- #line 55 "array_of_struct.pgc"
173
+ #line 56 "array_of_struct.pgc"
170
174
171
175
if (sqlca .sqlcode == ECPG_NOT_FOUND ) sqlprint ();
172
- #line 55 "array_of_struct.pgc"
176
+ #line 56 "array_of_struct.pgc"
173
177
174
178
if (sqlca .sqlwarn [0 ] == 'W' ) sqlprint ();
175
- #line 55 "array_of_struct.pgc"
179
+ #line 56 "array_of_struct.pgc"
176
180
177
181
if (sqlca .sqlcode < 0 ) sqlprint ();}
178
- #line 55 "array_of_struct.pgc"
182
+ #line 56 "array_of_struct.pgc"
179
183
180
184
printf ("custs1:\n" );
181
185
for (r = 0 ; r < 2 ; r ++ )
@@ -189,16 +193,16 @@ if (sqlca.sqlcode < 0) sqlprint();}
189
193
ECPGt_short ,& (inds -> name_ind ),(long )1 ,(long )10 ,sizeof ( struct ind ),
190
194
ECPGt_int ,& (custs2 -> phone ),(long )1 ,(long )10 ,sizeof ( customer2 ),
191
195
ECPGt_short ,& (inds -> phone_ind ),(long )1 ,(long )10 ,sizeof ( struct ind ), ECPGt_EORT );
192
- #line 63 "array_of_struct.pgc"
196
+ #line 64 "array_of_struct.pgc"
193
197
194
198
if (sqlca .sqlcode == ECPG_NOT_FOUND ) sqlprint ();
195
- #line 63 "array_of_struct.pgc"
199
+ #line 64 "array_of_struct.pgc"
196
200
197
201
if (sqlca .sqlwarn [0 ] == 'W' ) sqlprint ();
198
- #line 63 "array_of_struct.pgc"
202
+ #line 64 "array_of_struct.pgc"
199
203
200
204
if (sqlca .sqlcode < 0 ) sqlprint ();}
201
- #line 63 "array_of_struct.pgc"
205
+ #line 64 "array_of_struct.pgc"
202
206
203
207
printf ("\ncusts2:\n" );
204
208
for (r = 0 ; r < 2 ; r ++ )
@@ -212,16 +216,16 @@ if (sqlca.sqlcode < 0) sqlprint();}
212
216
ECPGt_short ,& (inds -> name_ind ),(long )1 ,(long )10 ,sizeof ( struct ind ),
213
217
ECPGt_int ,& (custs3 -> phone ),(long )1 ,(long )10 ,sizeof ( struct customer3 ),
214
218
ECPGt_short ,& (inds -> phone_ind ),(long )1 ,(long )10 ,sizeof ( struct ind ), ECPGt_EORT );
215
- #line 71 "array_of_struct.pgc"
219
+ #line 72 "array_of_struct.pgc"
216
220
217
221
if (sqlca .sqlcode == ECPG_NOT_FOUND ) sqlprint ();
218
- #line 71 "array_of_struct.pgc"
222
+ #line 72 "array_of_struct.pgc"
219
223
220
224
if (sqlca .sqlwarn [0 ] == 'W' ) sqlprint ();
221
- #line 71 "array_of_struct.pgc"
225
+ #line 72 "array_of_struct.pgc"
222
226
223
227
if (sqlca .sqlcode < 0 ) sqlprint ();}
224
- #line 71 "array_of_struct.pgc"
228
+ #line 72 "array_of_struct.pgc"
225
229
226
230
printf ("\ncusts3:\n" );
227
231
for (r = 0 ; r < 2 ; r ++ )
@@ -235,29 +239,49 @@ if (sqlca.sqlcode < 0) sqlprint();}
235
239
ECPGt_short ,& (inds [0 ].name_ind ),(long )1 ,(long )1 ,sizeof (short ),
236
240
ECPGt_int ,& (custs4 .phone ),(long )1 ,(long )1 ,sizeof (int ),
237
241
ECPGt_short ,& (inds [0 ].phone_ind ),(long )1 ,(long )1 ,sizeof (short ), ECPGt_EORT );
238
- #line 79 "array_of_struct.pgc"
242
+ #line 80 "array_of_struct.pgc"
239
243
240
244
if (sqlca .sqlcode == ECPG_NOT_FOUND ) sqlprint ();
241
- #line 79 "array_of_struct.pgc"
245
+ #line 80 "array_of_struct.pgc"
242
246
243
247
if (sqlca .sqlwarn [0 ] == 'W' ) sqlprint ();
244
- #line 79 "array_of_struct.pgc"
248
+ #line 80 "array_of_struct.pgc"
245
249
246
250
if (sqlca .sqlcode < 0 ) sqlprint ();}
247
- #line 79 "array_of_struct.pgc"
251
+ #line 80 "array_of_struct.pgc"
248
252
249
253
printf ("\ncusts4:\n" );
250
254
printf ( "name - %s\n" , custs4 .name .arr );
251
255
printf ( "phone - %d\n" , custs4 .phone );
252
256
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"
261
+
262
+ if (sqlca .sqlcode == ECPG_NOT_FOUND ) sqlprint ();
263
+ #line 85 "array_of_struct.pgc"
264
+
265
+ if (sqlca .sqlwarn [0 ] == 'W' ) sqlprint ();
266
+ #line 85 "array_of_struct.pgc"
267
+
268
+ if (sqlca .sqlcode < 0 ) sqlprint ();}
269
+ #line 85 "array_of_struct.pgc"
270
+
271
+ printf ("\nname:\n" );
272
+ for (r = 0 ; r < 2 ; r ++ )
273
+ {
274
+ printf ( "name - %s\n" , onlyname [r ].arr );
275
+ }
276
+
253
277
{ ECPGdisconnect (__LINE__ , "ALL" );
254
- #line 84 "array_of_struct.pgc"
278
+ #line 92 "array_of_struct.pgc"
255
279
256
280
if (sqlca .sqlwarn [0 ] == 'W' ) sqlprint ();
257
- #line 84 "array_of_struct.pgc"
281
+ #line 92 "array_of_struct.pgc"
258
282
259
283
if (sqlca .sqlcode < 0 ) sqlprint ();}
260
- #line 84 "array_of_struct.pgc"
284
+ #line 92 "array_of_struct.pgc"
261
285
262
286
263
287
return ( 0 );
0 commit comments