ECPG scoping

From: "Stergios Zissakis" <szis(at)intranet(dot)gr>
To: "Interfaces" <pgsql-interfaces(at)postgresql(dot)org>
Subject: ECPG scoping
Date: 2004-05-12 08:56:41
Message-ID: NGBBJHBHDKPNOODGDMMAKENFCHAA.szis@intranet.gr
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-interfaces

Dear all,

Consider the following two functions:

void function1(...)
{
EXEC SQL BEGIN DECLARE SECTION;
typedef struct
{
varchar temp[100];
...
} my_strct;
EXEC SQL END DECLARE SECTION;

...
}

void function2(...)
{
EXEC SQL BEGIN DECLARE SECTION;
typedef struct
{
varchar temp[100];
...
} my_strct;
EXEC SQL END DECLARE SECTION;

...
}

When this goes through the pre-compiler, I get an error message stating:
Type my_struct already defined.

Does ECPG recongise scopes or it parses everything as global space?

One work around is to rename the struct in each function but this is not
really handy as the application I'm porting (from Oracle) uses the same
stucts in a lot of methods.

Any suggestions?

Thanks in advance.

Regards,

Stergios Zissakis

Responses

Browse pgsql-interfaces by date

  From Date Subject
Next Message Elinor Medezinski 2004-05-16 11:56:10 Error code handling in perl
Previous Message wespvp 2004-05-09 23:36:44 ECPG multiple INSERTS or SELECTS in one command?