RE: BUG #15176: ecpg generation error
От | Höppner, Uwe |
---|---|
Тема | RE: BUG #15176: ecpg generation error |
Дата | |
Msg-id | 09F54CFD952B8A4EAEED88EDD6EC37C57A1D0467@Infra-Bln-Mbx1.psi.de обсуждение исходный текст |
Ответ на | Re: BUG #15176: ecpg generation error (Michael Meskes <meskes@postgresql.org>) |
Ответы |
Re: BUG #15176: ecpg generation error
|
Список | pgsql-bugs |
Hello Michael, sorry how I wrote my message. English is not my first language. I didn't try to offend or blame anybody. I am happy, that there are volunteers like you and I respect all who work at postgresql. You wrote: > To everyone out there that does not read German, the error message says > that type "fkt1::varchar1" is undefined. Uwe, it surely helps sending > English error messages to an English language mailing list. > > Not sure what you or your compiler are doing, but the last time I > checked defining a struct within a struct works nicely in *C*. It > probably does not in C++, but ecpg is not a C++ precompiler! > I compiled again the generated file in C mode and it worked. So thank you for this hint. It was not clear for me, that scope works differently in C and C++ and scope does not really exist under C. I would appreciate a small change. If ecpg would use sizeof("variable") instead of sizeof("type") the generated code compile also with a C++-compiler. Is it possible to extend ecpg that way? The name of the variable is already used in the same line to describe the input or output value in ECPGdo command. Cheers, Uwe An example: int main() { EXEC SQL BEGIN DECLARE SECTION; struct HostVar_t { int i; VARCHAR name[128]; }; struct HostVar_t hostvar; EXEC SQL END DECLARE SECTION; unsigned long long sz; /* sizeof used by ecpg in ECPGdo */ sz = sizeof(struct varchar_1); /* change, compiles as C and C++ */ sz = sizeof(hostvar.name); EXEC SQL INSERT INTO names_ta(col_i,col_name) VALUES( :hostvar.i, :hostvar.name ); return 0; } /* generated code by ecpg { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "insert into names_ta ( col_i , col_name ) values ( $1 , $2 )", ECPGt_int,&(hostvar.i),(long)1,(long)1,sizeof(int), ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_varchar,&(hostvar.name),(long)128,(long)1,sizeof(struct varchar_1), ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);} */
В списке pgsql-bugs по дате отправления: