Обсуждение: ECPG and structure declaration
ECPG and structure declaration
Hello,
why is the following code fragment an error for ecpg ?
---------------------------------------------
EXEC SQL BEGIN DECLARE SECTION;
struct base
{ char basekey [ 26 ];
};
EXEC SQL END DECLARE SECTION;
struct base b1[10];
struct base *b2;
---------------------------------------------
ecpg gives the error message:
demo.q:5: ERROR: syntax error at or near ";"
Versions:
- ecpg (PostgreSQL 7.3.3) 2.10.0
- Linux scaleo 2.4.18-4GB #1 Wed Mar 27 13:57:05 UTC 2002 i686 unknown
My intention is to declare the structure type in an include file and
define arrays, pointers, etc from the declaration in various .c files.
What's wrong ?
Cheers,
Jürgen
On Sun, Sep 21, 2003 at 08:46:02AM +0200, Jürgen Cappel wrote:
> why is the following code fragment an error for ecpg ?
>
> ---------------------------------------------
> EXEC SQL BEGIN DECLARE SECTION;
> struct base
> {
> char basekey [ 26 ];
> };
> EXEC SQL END DECLARE SECTION;
Because the struct is not used to define a variable.
The next release will be able to correctly parse this kind of definition
itself, but until then you have to list the whole struct definition
when defining the variable.
Michael
--
Michael Meskes
Email: Michael at Fam-Meskes dot De
ICQ: 179140304, AIM/Yahoo: michaelmeskes, Jabber: meskes@jabber.org
Go SF 49ers! Go Rhein Fire! Use Debian GNU/Linux! Use PostgreSQL!