1- /* $Header: /cvsroot/pgsql/src/interfaces/ecpg/preproc/Attic/preproc.y,v 1.245 2003/07/08 12:11:32 meskes Exp $*/
1+ /* $Header: /cvsroot/pgsql/src/interfaces/ecpg/preproc/Attic/preproc.y,v 1.246 2003/07/09 14:53:18 meskes Exp $*/
22
33/* Copyright comment*/
44%{
@@ -202,7 +202,7 @@ adjust_informix(struct arguments *list)
202202
203203for (ptr = list; ptr !=NULL ; ptr = ptr->next )
204204 {
205- char temp[sizeof ( int )+ sizeof ( " , &() " )];
205+ char temp[20 ]; /* this should be sufficient unless you have 8 byte integers */
206206char *original_var;
207207
208208/* change variable name to "ECPG_informix_get_var(<counter>)"*/
@@ -221,6 +221,27 @@ adjust_informix(struct arguments *list)
221221sprintf (temp," %d, &(" , ecpg_informix_var++);
222222}
223223result =cat_str (5 , result,make_str (" ECPG_informix_set_var(" ),mm_strdup (temp),mm_strdup (original_var),make_str (" ), __LINE__);\n " ));
224+
225+ /* now the indicator if there is one*/
226+ if (ptr->indicator ->type ->type != ECPGt_NO_INDICATOR)
227+ {
228+ /* change variable name to "ECPG_informix_get_var(<counter>)"*/
229+ original_var = ptr->indicator ->name ;
230+ sprintf (temp," %d))" , ecpg_informix_var);
231+
232+ /* create call to "ECPG_informix_set_var(<counter>, <pointer>. <linen number>)"*/
233+ if (atoi (ptr->indicator ->type ->size ) >1 )
234+ {
235+ ptr->indicator =new_variable (cat_str (4 ,make_str (" (" ),mm_strdup (ECPGtype_name (ptr->indicator ->type ->type )),make_str (" *)(ECPG_informix_get_var(" ),mm_strdup (temp)),ECPGmake_simple_type (ptr->indicator ->type ->type , ptr->indicator ->type ->size ),0 );
236+ sprintf (temp," %d, (" , ecpg_informix_var++);
237+ }
238+ else
239+ {
240+ ptr->indicator =new_variable (cat_str (4 ,make_str (" *(" ),mm_strdup (ECPGtype_name (ptr->indicator ->type ->type )),make_str (" *)(ECPG_informix_get_var(" ),mm_strdup (temp)),ECPGmake_simple_type (ptr->indicator ->type ->type , ptr->indicator ->type ->size ),0 );
241+ sprintf (temp," %d, &(" , ecpg_informix_var++);
242+ }
243+ result =cat_str (5 , result,make_str (" ECPG_informix_set_var(" ),mm_strdup (temp),mm_strdup (original_var),make_str (" ), __LINE__);\n " ));
244+ }
224245 }
225246
226247return result;
@@ -6097,7 +6118,7 @@ c_args: /*EMPTY*/{ $$ = EMPTY; }
60976118coutputvariable :CVARIABLE indicator
60986119{ add_variable(&argsresult, find_variable($1 ), find_variable($2 )); }
60996120| CVARIABLE
6100- { add_variable(&argsresult, find_variable($1 ), &no_indicator); }
6121+ { add_variable(&argsresult, find_variable($1 ), &no_indicator); }
61016122;
61026123
61036124