how should you define a struct within EXEC SQL section?

From: bayard kohlhepp <bayardk(at)crosslink(dot)net>
To: pgsql-hackers(at)postgreSQL(dot)org
Subject: how should you define a struct within EXEC SQL section?
Date: 1999-11-12 21:47:33
Message-ID: 382C8AF5.D4EEFBD6@crosslink.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


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?

Browse pgsql-hackers by date

  From Date Subject
Next Message Hannu Krosing 1999-11-12 22:02:54 Re: [HACKERS] compression in LO and other fields
Previous Message bayard kohlhepp 1999-11-12 21:09:48 how to handle struct within EXEC SQL DECLARE SECTION?