Christof Petig wrote:
> > > > exec sql type str is varchar[8];
> > > > str *var=NULL;
> > >
> > > Shudder. There should be a decent syntax to specify this. If anyone ever
> > > needs this functionality!!!
I found the actual way to get this :
- it is possible to create a pointer to a varchar, simply use the
braindead (to me) syntax:
varchar type[][maxlen]=0; or varchar type[0][maxlen]=0;
- ecpg and the C compiler do not agree on the meaning of
char *foo[80];
for the compiler it is an array of 80 char*s for ecpg it's obviously equivalent to char foo[80][0]; (simply try it)
whichis pretty useless for an output variable but might be ok for an input variable if the offset (sizeof char) would
beright (sizeof char*).
- the interesting syntax
char (*foo)[80]; (pointer to an array of char[80])
is not possible in ecpg, but seems to be the one supported by the lib.
To sum it up: variable declaration and variable initialization are some of the
weakest points in ecpg.
Christof (implementing char **)
PS: casts do not work when initializing variables ( e.g. int VAR = (int) 1.5; ->
syntax error)