How do I handle host variables passed in the where clause
of a declared cursor? It seems "ecpg" 2.9 takes the declare/open
and puts the resulting code near the open. This seems to be a bad
thing if the host variable is declared in a different block or function:
Consider...
func()
{ exec sql begin declare section; int i; exec sql end declare section;
exec sql declare c1 cursor for select x from y where i = :i;
}
func2()
{ exec sql open c1;
}
...yields...
/* exec sql begin declare section */
#line 3 "a.pgc" int i ;
/* exec sql end declare section */
#line 4 "a.pgc"
/* declare c1 cursor for select x from y where i = ? */
#line 6 "a.pgc"
}
func2()
{ { ECPGdo(__LINE__, NULL, "declare c1 cursor for select x from y where
i
= ? ", ECPGt_int,&(0~V7@0~V7@^P),1L,1L,sizeof(int), ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT,
ECPGt_EORT);}
#line 10 "a.pgc"
}
Obviously the precompiler has no knowledge of the local host variable
in the other function.
Tim Nelson