Re: ECPG: Automatic Storage allocation for NULL-pointing

From: Christof Petig <christof(at)petig-baender(dot)de>
To: Interfaces <pgsql-interfaces(at)postgresql(dot)org>
Cc: Michael Meskes <meskes(at)postgresql(dot)org>
Subject: Re: ECPG: Automatic Storage allocation for NULL-pointing
Date: 2001-10-30 09:46:03
Message-ID: 3BDE76DB.90039F22@petig-baender.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-interfaces

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)
which is pretty useless for an output variable but might be ok for an input
variable if the offset (sizeof char) would be right (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)

In response to

Responses

Browse pgsql-interfaces by date

  From Date Subject
Next Message Christof Petig 2001-10-30 10:02:28 Re: ECPG - connection name in "EXEC SQL AT ... " statement
Previous Message DI Hasenöhrl 2001-10-30 08:42:20 Re: DAO VB ODBC "read only problems