@@ -81,6 +81,7 @@ int main( int argc, char * argv[] )
8181
8282
8383
84+
8485
8586#line 26 "array_of_struct.pgc"
8687 customer custs1 [ 10 ] ;
@@ -111,71 +112,74 @@ int main( int argc, char * argv[] )
111112
112113#line 44 "array_of_struct.pgc"
113114 int r ;
114- /* exec sql end declare section */
115+
115116#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"
116120
117121
118122 ECPGdebug (1 , stderr );
119123
120124 { ECPGconnect (__LINE__ , 0 , "regress1" , NULL , NULL , NULL , 0 );
121- #line 49 "array_of_struct.pgc"
125+ #line 50 "array_of_struct.pgc"
122126
123127if (sqlca .sqlwarn [0 ] == 'W' ) sqlprint ();
124- #line 49 "array_of_struct.pgc"
128+ #line 50 "array_of_struct.pgc"
125129
126130if (sqlca .sqlcode < 0 ) sqlprint ();}
127- #line 49 "array_of_struct.pgc"
131+ #line 50 "array_of_struct.pgc"
128132
129133
130134 { 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"
132136
133137if (sqlca .sqlwarn [0 ] == 'W' ) sqlprint ();
134- #line 51 "array_of_struct.pgc"
138+ #line 52 "array_of_struct.pgc"
135139
136140if (sqlca .sqlcode < 0 ) sqlprint ();}
137- #line 51 "array_of_struct.pgc"
141+ #line 52 "array_of_struct.pgc"
138142
139143 { 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"
141145
142146if (sqlca .sqlcode == ECPG_NOT_FOUND ) sqlprint ();
143- #line 52 "array_of_struct.pgc"
147+ #line 53 "array_of_struct.pgc"
144148
145149if (sqlca .sqlwarn [0 ] == 'W' ) sqlprint ();
146- #line 52 "array_of_struct.pgc"
150+ #line 53 "array_of_struct.pgc"
147151
148152if (sqlca .sqlcode < 0 ) sqlprint ();}
149- #line 52 "array_of_struct.pgc"
153+ #line 53 "array_of_struct.pgc"
150154
151155 { 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"
153157
154158if (sqlca .sqlcode == ECPG_NOT_FOUND ) sqlprint ();
155- #line 53 "array_of_struct.pgc"
159+ #line 54 "array_of_struct.pgc"
156160
157161if (sqlca .sqlwarn [0 ] == 'W' ) sqlprint ();
158- #line 53 "array_of_struct.pgc"
162+ #line 54 "array_of_struct.pgc"
159163
160164if (sqlca .sqlcode < 0 ) sqlprint ();}
161- #line 53 "array_of_struct.pgc"
165+ #line 54 "array_of_struct.pgc"
162166
163167
164168 { ECPGdo (__LINE__ , 0 , 1 , NULL , 0 , ECPGst_normal , "select * from customers limit 2 " , ECPGt_EOIT ,
165169 ECPGt_varchar ,& (custs1 -> name ),(long )50 ,(long )10 ,sizeof ( customer ),
166170 ECPGt_short ,& (inds -> name_ind ),(long )1 ,(long )10 ,sizeof ( struct ind ),
167171 ECPGt_int ,& (custs1 -> phone ),(long )1 ,(long )10 ,sizeof ( customer ),
168172 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"
170174
171175if (sqlca .sqlcode == ECPG_NOT_FOUND ) sqlprint ();
172- #line 55 "array_of_struct.pgc"
176+ #line 56 "array_of_struct.pgc"
173177
174178if (sqlca .sqlwarn [0 ] == 'W' ) sqlprint ();
175- #line 55 "array_of_struct.pgc"
179+ #line 56 "array_of_struct.pgc"
176180
177181if (sqlca .sqlcode < 0 ) sqlprint ();}
178- #line 55 "array_of_struct.pgc"
182+ #line 56 "array_of_struct.pgc"
179183
180184 printf ("custs1:\n" );
181185 for (r = 0 ; r < 2 ; r ++ )
@@ -189,16 +193,16 @@ if (sqlca.sqlcode < 0) sqlprint();}
189193 ECPGt_short ,& (inds -> name_ind ),(long )1 ,(long )10 ,sizeof ( struct ind ),
190194 ECPGt_int ,& (custs2 -> phone ),(long )1 ,(long )10 ,sizeof ( customer2 ),
191195 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"
193197
194198if (sqlca .sqlcode == ECPG_NOT_FOUND ) sqlprint ();
195- #line 63 "array_of_struct.pgc"
199+ #line 64 "array_of_struct.pgc"
196200
197201if (sqlca .sqlwarn [0 ] == 'W' ) sqlprint ();
198- #line 63 "array_of_struct.pgc"
202+ #line 64 "array_of_struct.pgc"
199203
200204if (sqlca .sqlcode < 0 ) sqlprint ();}
201- #line 63 "array_of_struct.pgc"
205+ #line 64 "array_of_struct.pgc"
202206
203207 printf ("\ncusts2:\n" );
204208 for (r = 0 ; r < 2 ; r ++ )
@@ -212,16 +216,16 @@ if (sqlca.sqlcode < 0) sqlprint();}
212216 ECPGt_short ,& (inds -> name_ind ),(long )1 ,(long )10 ,sizeof ( struct ind ),
213217 ECPGt_int ,& (custs3 -> phone ),(long )1 ,(long )10 ,sizeof ( struct customer3 ),
214218 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"
216220
217221if (sqlca .sqlcode == ECPG_NOT_FOUND ) sqlprint ();
218- #line 71 "array_of_struct.pgc"
222+ #line 72 "array_of_struct.pgc"
219223
220224if (sqlca .sqlwarn [0 ] == 'W' ) sqlprint ();
221- #line 71 "array_of_struct.pgc"
225+ #line 72 "array_of_struct.pgc"
222226
223227if (sqlca .sqlcode < 0 ) sqlprint ();}
224- #line 71 "array_of_struct.pgc"
228+ #line 72 "array_of_struct.pgc"
225229
226230 printf ("\ncusts3:\n" );
227231 for (r = 0 ; r < 2 ; r ++ )
@@ -235,29 +239,49 @@ if (sqlca.sqlcode < 0) sqlprint();}
235239 ECPGt_short ,& (inds [0 ].name_ind ),(long )1 ,(long )1 ,sizeof (short ),
236240 ECPGt_int ,& (custs4 .phone ),(long )1 ,(long )1 ,sizeof (int ),
237241 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"
239243
240244if (sqlca .sqlcode == ECPG_NOT_FOUND ) sqlprint ();
241- #line 79 "array_of_struct.pgc"
245+ #line 80 "array_of_struct.pgc"
242246
243247if (sqlca .sqlwarn [0 ] == 'W' ) sqlprint ();
244- #line 79 "array_of_struct.pgc"
248+ #line 80 "array_of_struct.pgc"
245249
246250if (sqlca .sqlcode < 0 ) sqlprint ();}
247- #line 79 "array_of_struct.pgc"
251+ #line 80 "array_of_struct.pgc"
248252
249253 printf ("\ncusts4:\n" );
250254 printf ( "name - %s\n" , custs4 .name .arr );
251255 printf ( "phone - %d\n" , custs4 .phone );
252256
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+
253277 { ECPGdisconnect (__LINE__ , "ALL" );
254- #line 84 "array_of_struct.pgc"
278+ #line 92 "array_of_struct.pgc"
255279
256280if (sqlca .sqlwarn [0 ] == 'W' ) sqlprint ();
257- #line 84 "array_of_struct.pgc"
281+ #line 92 "array_of_struct.pgc"
258282
259283if (sqlca .sqlcode < 0 ) sqlprint ();}
260- #line 84 "array_of_struct.pgc"
284+ #line 92 "array_of_struct.pgc"
261285
262286
263287 return ( 0 );
0 commit comments