@@ -51,7 +51,7 @@ main(void)
5151
5252
5353#line 27 "bytea.pgc"
54- struct bytea_1 { int len ; char arr [ DATA_SIZE ]; } send_buf [ 2 ] ;
54+ struct bytea_1 { int len ; char arr [ 512 ]; } send_buf [ 2 ] ;
5555
5656#line 28 "bytea.pgc"
5757 struct bytea_2 { int len ; char arr [ DATA_SIZE ]; } recv_buf [ 2 ] ;
@@ -139,9 +139,9 @@ if (sqlca.sqlcode < 0) sqlprint();}
139139#line 68 "bytea.pgc"
140140
141141 { ECPGdo (__LINE__ , 0 , 1 , NULL , 0 , ECPGst_normal , "insert into test values ( $1 , $2 )" ,
142- ECPGt_bytea ,& (send_buf [0 ]),(long )DATA_SIZE ,(long )1 ,sizeof (struct bytea_1 ),
142+ ECPGt_bytea ,& (send_buf [0 ]),(long )512 ,(long )1 ,sizeof (struct bytea_1 ),
143143 ECPGt_NO_INDICATOR , NULL , 0L , 0L , 0L ,
144- ECPGt_bytea ,& (send_buf [1 ]),(long )DATA_SIZE ,(long )1 ,sizeof (struct bytea_1 ),
144+ ECPGt_bytea ,& (send_buf [1 ]),(long )512 ,(long )1 ,sizeof (struct bytea_1 ),
145145 ECPGt_NO_INDICATOR , NULL , 0L , 0L , 0L , ECPGt_EOIT , ECPGt_EORT );
146146#line 69 "bytea.pgc"
147147
@@ -161,7 +161,7 @@ if (sqlca.sqlcode < 0) sqlprint();}
161161 dump_binary (recv_buf [0 ].arr , recv_buf [0 ].len , ind [0 ]);
162162 dump_binary (recv_short_buf .arr , recv_short_buf .len , ind [1 ]);
163163
164- /* Test for variable length array */
164+ /* Test for cursor */
165165 init ();
166166 { ECPGdo (__LINE__ , 0 , 1 , NULL , 0 , ECPGst_normal , "truncate test" , ECPGt_EOIT , ECPGt_EORT );
167167#line 76 "bytea.pgc"
@@ -170,32 +170,89 @@ if (sqlca.sqlcode < 0) sqlprint();}
170170#line 76 "bytea.pgc"
171171
172172 { ECPGdo (__LINE__ , 0 , 1 , NULL , 0 , ECPGst_normal , "insert into test values ( $1 , $2 )" ,
173- ECPGt_bytea ,& (send_buf [0 ]),(long )DATA_SIZE ,(long )1 ,sizeof (struct bytea_1 ),
173+ ECPGt_bytea ,& (send_buf [0 ]),(long )512 ,(long )1 ,sizeof (struct bytea_1 ),
174174 ECPGt_NO_INDICATOR , NULL , 0L , 0L , 0L ,
175- ECPGt_bytea ,& (send_buf [1 ]),(long )DATA_SIZE ,(long )1 ,sizeof (struct bytea_1 ),
175+ ECPGt_bytea ,& (send_buf [1 ]),(long )512 ,(long )1 ,sizeof (struct bytea_1 ),
176176 ECPGt_NO_INDICATOR , NULL , 0L , 0L , 0L , ECPGt_EOIT , ECPGt_EORT );
177177#line 77 "bytea.pgc"
178178
179179if (sqlca .sqlcode < 0 ) sqlprint ();}
180180#line 77 "bytea.pgc"
181181
182+ ECPGset_var ( 0 , & ( send_buf [0 ] ), __LINE__ );\
183+ /* declare cursor1 cursor for select data1 from test where data1 = $1 */
184+ #line 78 "bytea.pgc"
185+
186+ if (sqlca .sqlcode < 0 ) sqlprint ();
187+ #line 78 "bytea.pgc"
188+
189+ #line 78 "bytea.pgc"
190+
191+ { ECPGdo (__LINE__ , 0 , 1 , NULL , 0 , ECPGst_normal , "declare cursor1 cursor for select data1 from test where data1 = $1 " ,
192+ ECPGt_bytea ,& (send_buf [0 ]),(long )512 ,(long )1 ,sizeof (struct bytea_1 ),
193+ ECPGt_NO_INDICATOR , NULL , 0L , 0L , 0L , ECPGt_EOIT , ECPGt_EORT );
194+ #line 79 "bytea.pgc"
195+
196+ if (sqlca .sqlcode < 0 ) sqlprint ();}
197+ #line 79 "bytea.pgc"
198+
199+ { ECPGdo (__LINE__ , 0 , 1 , NULL , 0 , ECPGst_normal , "fetch from cursor1" , ECPGt_EOIT ,
200+ ECPGt_bytea ,& (recv_buf [0 ]),(long )DATA_SIZE ,(long )1 ,sizeof (struct bytea_2 ),
201+ ECPGt_NO_INDICATOR , NULL , 0L , 0L , 0L , ECPGt_EORT );
202+ #line 80 "bytea.pgc"
203+
204+ if (sqlca .sqlcode < 0 ) sqlprint ();}
205+ #line 80 "bytea.pgc"
206+
207+ { ECPGdo (__LINE__ , 0 , 1 , NULL , 0 , ECPGst_normal , "close cursor1" , ECPGt_EOIT , ECPGt_EORT );
208+ #line 81 "bytea.pgc"
209+
210+ if (sqlca .sqlcode < 0 ) sqlprint ();}
211+ #line 81 "bytea.pgc"
212+
213+ { ECPGdeallocate (__LINE__ , 0 , NULL , "cursor1" );
214+ #line 82 "bytea.pgc"
215+
216+ if (sqlca .sqlcode < 0 ) sqlprint ();}
217+ #line 82 "bytea.pgc"
218+
219+ dump_binary (recv_buf [0 ].arr , recv_buf [0 ].len , 0 );
220+
221+ /* Test for variable length array */
222+ init ();
223+ { ECPGdo (__LINE__ , 0 , 1 , NULL , 0 , ECPGst_normal , "truncate test" , ECPGt_EOIT , ECPGt_EORT );
224+ #line 87 "bytea.pgc"
225+
226+ if (sqlca .sqlcode < 0 ) sqlprint ();}
227+ #line 87 "bytea.pgc"
228+
182229 { ECPGdo (__LINE__ , 0 , 1 , NULL , 0 , ECPGst_normal , "insert into test values ( $1 , $2 )" ,
183- ECPGt_bytea ,& (send_buf [0 ]),(long )DATA_SIZE ,(long )1 ,sizeof (struct bytea_1 ),
230+ ECPGt_bytea ,& (send_buf [0 ]),(long )512 ,(long )1 ,sizeof (struct bytea_1 ),
184231 ECPGt_NO_INDICATOR , NULL , 0L , 0L , 0L ,
185- ECPGt_bytea ,& (send_buf [1 ]),(long )DATA_SIZE ,(long )1 ,sizeof (struct bytea_1 ),
232+ ECPGt_bytea ,& (send_buf [1 ]),(long )512 ,(long )1 ,sizeof (struct bytea_1 ),
186233 ECPGt_NO_INDICATOR , NULL , 0L , 0L , 0L , ECPGt_EOIT , ECPGt_EORT );
187- #line 78 "bytea.pgc"
234+ #line 88 "bytea.pgc"
188235
189236if (sqlca .sqlcode < 0 ) sqlprint ();}
190- #line 78 "bytea.pgc"
237+ #line 88 "bytea.pgc"
238+
239+ { ECPGdo (__LINE__ , 0 , 1 , NULL , 0 , ECPGst_normal , "insert into test values ( $1 , $2 )" ,
240+ ECPGt_bytea ,& (send_buf [0 ]),(long )512 ,(long )1 ,sizeof (struct bytea_1 ),
241+ ECPGt_NO_INDICATOR , NULL , 0L , 0L , 0L ,
242+ ECPGt_bytea ,& (send_buf [1 ]),(long )512 ,(long )1 ,sizeof (struct bytea_1 ),
243+ ECPGt_NO_INDICATOR , NULL , 0L , 0L , 0L , ECPGt_EOIT , ECPGt_EORT );
244+ #line 89 "bytea.pgc"
245+
246+ if (sqlca .sqlcode < 0 ) sqlprint ();}
247+ #line 89 "bytea.pgc"
191248
192249 { ECPGdo (__LINE__ , 0 , 1 , NULL , 0 , ECPGst_normal , "select data1 from test" , ECPGt_EOIT ,
193250 ECPGt_bytea ,& (recv_vlen_buf ),(long )DATA_SIZE ,(long )0 ,sizeof (struct bytea_3 ),
194251 ECPGt_NO_INDICATOR , NULL , 0L , 0L , 0L , ECPGt_EORT );
195- #line 79 "bytea.pgc"
252+ #line 90 "bytea.pgc"
196253
197254if (sqlca .sqlcode < 0 ) sqlprint ();}
198- #line 79 "bytea.pgc"
255+ #line 90 "bytea.pgc"
199256
200257 dump_binary (recv_vlen_buf [0 ].arr , recv_vlen_buf [0 ].len , 0 );
201258 dump_binary (recv_vlen_buf [1 ].arr , recv_vlen_buf [1 ].len , 0 );
@@ -204,112 +261,112 @@ if (sqlca.sqlcode < 0) sqlprint();}
204261 /* Test for dynamic sql statement with normal host variable, indicator */
205262 init ();
206263 { ECPGdo (__LINE__ , 0 , 1 , NULL , 0 , ECPGst_normal , "truncate test" , ECPGt_EOIT , ECPGt_EORT );
207- #line 86 "bytea.pgc"
264+ #line 97 "bytea.pgc"
208265
209266if (sqlca .sqlcode < 0 ) sqlprint ();}
210- #line 86 "bytea.pgc"
267+ #line 97 "bytea.pgc"
211268
212269 { ECPGdo (__LINE__ , 0 , 1 , NULL , 0 , ECPGst_execute , "ins_stmt" ,
213- ECPGt_bytea ,& (send_buf [0 ]),(long )DATA_SIZE ,(long )1 ,sizeof (struct bytea_1 ),
270+ ECPGt_bytea ,& (send_buf [0 ]),(long )512 ,(long )1 ,sizeof (struct bytea_1 ),
214271 ECPGt_NO_INDICATOR , NULL , 0L , 0L , 0L ,
215- ECPGt_bytea ,& (send_buf [1 ]),(long )DATA_SIZE ,(long )1 ,sizeof (struct bytea_1 ),
272+ ECPGt_bytea ,& (send_buf [1 ]),(long )512 ,(long )1 ,sizeof (struct bytea_1 ),
216273 ECPGt_NO_INDICATOR , NULL , 0L , 0L , 0L , ECPGt_EOIT , ECPGt_EORT );
217- #line 87 "bytea.pgc"
274+ #line 98 "bytea.pgc"
218275
219276if (sqlca .sqlcode < 0 ) sqlprint ();}
220- #line 87 "bytea.pgc"
277+ #line 98 "bytea.pgc"
221278
222279 { ECPGdo (__LINE__ , 0 , 1 , NULL , 0 , ECPGst_execute , "sel_stmt" , ECPGt_EOIT ,
223280 ECPGt_bytea ,& (recv_buf [0 ]),(long )DATA_SIZE ,(long )1 ,sizeof (struct bytea_2 ),
224281 ECPGt_int ,& (ind [0 ]),(long )1 ,(long )1 ,sizeof (int ),
225282 ECPGt_bytea ,& (recv_short_buf ),(long )DATA_SIZE - LACK_SIZE ,(long )1 ,sizeof (struct bytea_4 ),
226283 ECPGt_int ,& (ind [1 ]),(long )1 ,(long )1 ,sizeof (int ), ECPGt_EORT );
227- #line 88 "bytea.pgc"
284+ #line 99 "bytea.pgc"
228285
229286if (sqlca .sqlcode < 0 ) sqlprint ();}
230- #line 88 "bytea.pgc"
287+ #line 99 "bytea.pgc"
231288
232289 dump_binary (recv_buf [0 ].arr , recv_buf [0 ].len , ind [0 ]);
233290 dump_binary (recv_short_buf .arr , recv_short_buf .len , ind [1 ]);
234291
235292 /* Test for dynamic sql statement with sql descriptor */
236293 init ();
237294 { ECPGdo (__LINE__ , 0 , 1 , NULL , 0 , ECPGst_normal , "truncate test" , ECPGt_EOIT , ECPGt_EORT );
238- #line 94 "bytea.pgc"
295+ #line 105 "bytea.pgc"
239296
240297if (sqlca .sqlcode < 0 ) sqlprint ();}
241- #line 94 "bytea.pgc"
298+ #line 105 "bytea.pgc"
242299
243300 { ECPGset_desc (__LINE__ , "idesc" , 1 ,ECPGd_data ,
244- ECPGt_bytea ,& (send_buf [0 ]),(long )DATA_SIZE ,(long )1 ,sizeof (struct bytea_1 ), ECPGd_EODT );
301+ ECPGt_bytea ,& (send_buf [0 ]),(long )512 ,(long )1 ,sizeof (struct bytea_1 ), ECPGd_EODT );
245302
246- #line 95 "bytea.pgc"
303+ #line 106 "bytea.pgc"
247304
248305if (sqlca .sqlcode < 0 ) sqlprint ();}
249- #line 95 "bytea.pgc"
306+ #line 106 "bytea.pgc"
250307
251308 { ECPGset_desc (__LINE__ , "idesc" , 2 ,ECPGd_data ,
252- ECPGt_bytea ,& (send_buf [1 ]),(long )DATA_SIZE ,(long )1 ,sizeof (struct bytea_1 ), ECPGd_EODT );
309+ ECPGt_bytea ,& (send_buf [1 ]),(long )512 ,(long )1 ,sizeof (struct bytea_1 ), ECPGd_EODT );
253310
254- #line 96 "bytea.pgc"
311+ #line 107 "bytea.pgc"
255312
256313if (sqlca .sqlcode < 0 ) sqlprint ();}
257- #line 96 "bytea.pgc"
314+ #line 107 "bytea.pgc"
258315
259316 { ECPGdo (__LINE__ , 0 , 1 , NULL , 0 , ECPGst_execute , "ins_stmt" ,
260317 ECPGt_descriptor , "idesc" , 1L , 1L , 1L ,
261318 ECPGt_NO_INDICATOR , NULL , 0L , 0L , 0L , ECPGt_EOIT , ECPGt_EORT );
262- #line 97 "bytea.pgc"
319+ #line 108 "bytea.pgc"
263320
264321if (sqlca .sqlcode < 0 ) sqlprint ();}
265- #line 97 "bytea.pgc"
322+ #line 108 "bytea.pgc"
266323
267324 { ECPGdo (__LINE__ , 0 , 1 , NULL , 0 , ECPGst_execute , "sel_stmt" , ECPGt_EOIT ,
268325 ECPGt_descriptor , "odesc" , 1L , 1L , 1L ,
269326 ECPGt_NO_INDICATOR , NULL , 0L , 0L , 0L , ECPGt_EORT );
270- #line 98 "bytea.pgc"
327+ #line 109 "bytea.pgc"
271328
272329if (sqlca .sqlcode < 0 ) sqlprint ();}
273- #line 98 "bytea.pgc"
330+ #line 109 "bytea.pgc"
274331
275332 { ECPGget_desc (__LINE__ , "odesc" , 1 ,ECPGd_indicator ,
276333 ECPGt_int ,& (ind [0 ]),(long )1 ,(long )1 ,sizeof (int ), ECPGd_data ,
277334 ECPGt_bytea ,& (recv_buf [0 ]),(long )DATA_SIZE ,(long )1 ,sizeof (struct bytea_2 ), ECPGd_EODT );
278335
279- #line 99 "bytea.pgc"
336+ #line 110 "bytea.pgc"
280337
281338if (sqlca .sqlcode < 0 ) sqlprint ();}
282- #line 99 "bytea.pgc"
339+ #line 110 "bytea.pgc"
283340
284341 { ECPGget_desc (__LINE__ , "odesc" , 2 ,ECPGd_indicator ,
285342 ECPGt_int ,& (ind [1 ]),(long )1 ,(long )1 ,sizeof (int ), ECPGd_data ,
286343 ECPGt_bytea ,& (recv_short_buf ),(long )DATA_SIZE - LACK_SIZE ,(long )1 ,sizeof (struct bytea_4 ), ECPGd_EODT );
287344
288- #line 100 "bytea.pgc"
345+ #line 111 "bytea.pgc"
289346
290347if (sqlca .sqlcode < 0 ) sqlprint ();}
291- #line 100 "bytea.pgc"
348+ #line 111 "bytea.pgc"
292349
293350 dump_binary (recv_buf [0 ].arr , recv_buf [0 ].len , ind [0 ]);
294351 dump_binary (recv_short_buf .arr , recv_short_buf .len , ind [1 ]);
295352
296353 { ECPGdo (__LINE__ , 0 , 1 , NULL , 0 , ECPGst_normal , "drop table test" , ECPGt_EOIT , ECPGt_EORT );
297- #line 104 "bytea.pgc"
354+ #line 115 "bytea.pgc"
298355
299356if (sqlca .sqlcode < 0 ) sqlprint ();}
300- #line 104 "bytea.pgc"
357+ #line 115 "bytea.pgc"
301358
302359 { ECPGtrans (__LINE__ , NULL , "commit" );
303- #line 105 "bytea.pgc"
360+ #line 116 "bytea.pgc"
304361
305362if (sqlca .sqlcode < 0 ) sqlprint ();}
306- #line 105 "bytea.pgc"
363+ #line 116 "bytea.pgc"
307364
308365 { ECPGdisconnect (__LINE__ , "CURRENT" );
309- #line 106 "bytea.pgc"
366+ #line 117 "bytea.pgc"
310367
311368if (sqlca .sqlcode < 0 ) sqlprint ();}
312- #line 106 "bytea.pgc"
369+ #line 117 "bytea.pgc"
313370
314371
315372 return 0 ;
0 commit comments