i tried posting this to other groups, as well as searching the archives,
and came up with nothing.
i am using 6.5.2/Mandrake(RedHat)linux 6.0/pentium. i am trying to port
an existing informix 7 web application to postgresql. all of the CGI
programs use embedded SQL. they all use constructs of the form:
...
EXEC SQL BEGIN DECLARE SECTION;
struct user { /* 40 or 50 or 80 fields... */ int x; ...
};
EXEC SQL END DECLARE SECTION;
func1(struct user *x,...);
func2(struct user *X, ...);
main()
{ EXEC SQL BEGIN DECLARE SECTION; struct user user_rec; EXEC SQL END DECLARE SECTION;
...
}
ecpg doesn't recognize (ie, "parse error") struct declarations that
occurred outside of the current BEGIN/END section. that forces me to
redeclare the entire struct definition with every variable declaration.
i have gone through and exploded all the declarations to do that, but
now ecpg dies with a segmentation fault, does not report a line number,
and erases the .c in the process so i can't tell how far it got (i
experimented with 2 and 3 field structs, and it worked okay, but some of
these structs have 140+ fields).
what is the proper solution for defining a database record structure,
then declaring variables that use that definition within EXEC SQL
sections?