ECPG scoping - Mailing list pgsql-interfaces

From Stergios Zissakis
Subject ECPG scoping
Date
Msg-id NGBBJHBHDKPNOODGDMMAKENFCHAA.szis@intranet.gr
Whole thread Raw
Responses Re: ECPG scoping  (Michael Meskes <meskes@postgresql.org>)
List 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



pgsql-interfaces by date:

Previous
From:
Date:
Subject: ECPG multiple INSERTS or SELECTS in one command?
Next
From: Bruce Momjian
Date:
Subject: Re: Bug in translation of DEALLOCATE PREPARE