ecpg precompiler

From: Fabienne Leclere <fabienne(at)bira-iasb(dot)oma(dot)be>
To: pgsql-bugs(at)postgresql(dot)org
Subject: ecpg precompiler
Date: 2000-04-13 09:41:01
Message-ID: 38F5962D.87B01006@bira-iasb.oma.be
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

============================================================================

POSTGRESQL BUG REPORT TEMPLATE
============================================================================

Your name : Fabienne Leclere
Your email address : fabienne(at)oma(dot)be

System Configuration
---------------------
Architecture (example: Intel Pentium) : HP 9000 serie E

Operating System (example: Linux 2.0.26 ELF) : HPUX 11.0

PostgreSQL version (example: PostgreSQL-6.5.3): PostgreSQL-6.5.3

Compiler used (example: gcc 2.8.0) : aCC HP aC++ B3910B
A.03.13

Please enter a FULL description of your problem:
------------------------------------------------
With the ecpg precompiler:
when using structure to define a table or union to define a field
and insert values into the table, the arguments of the function ECPGdo
are not correctly generated.
Then the compiler give errors ....

Please describe a way to repeat the problem. Please try to provide a
concise reproducible example, if at all possible:
----------------------------------------------------------------------
1) create the ttest table:
create table ttest ( data0 double precision , data1 varchar(200));

2) the .pc file edit :

....
exec sql begin declare section;

struct ttest1_{ double bla0; varchar bla1[200]; }ttest1;

double data0;
union ttest2_ {
varchar bla1[200];
struct {short len; short lost; float buf[50]; }bla2;
}ttest2;

exec sql end declare section;
.....

exec sql insert into ttest values ( :ttest1);

exec sql insert into ttest values ( :data0,:ttest2.bla1);

3) precompile

the .c file give:

...
struct ttest1_ { double bla0 ;
struct varchar_bla1 { int len; char arr[200]; } bla1 ;
} ttest1 ;
double data0 ;
union ttest2_ { struct varchar_bla1 { int len; char arr[200]; }
bla1 ;
struct { short len ;
short lost ;
float buf[ 50 ] ;
} bla2 ;
} ttest2 ;
.....

{ ECPGdo(__LINE__, NULL, "insert into ttest values(?)",
ECPGt_double,&(ttest1.bla0),1L,1L,sizeof(double),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
ECPGt_varchar,&(ttest1.bla1),200L,1L,sizeof(struct
varchar_bla1),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);}

.......

{ ECPGdo(__LINE__, NULL, "insert into ttest values(? , ?)",
ECPGt_double,&(data0),1L,1L,sizeof(double),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
ECPGt_varchar,&(ttest2.bla1),200L,1L,sizeof(struct
varchar_ttest2.bla1),

ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);}

.............

and it should be:

.............

{ ECPGdo(__LINE__, NULL, "insert into ttest values(? , ?)",
ECPGt_double,&(ttest1.bla0),1L,1L,sizeof(double),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
ECPGt_varchar,&(ttest1.bla1),200L,1L,sizeof(struct
ttest1_::varchar_bla1),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);}

.............

{ ECPGdo(__LINE__, NULL, "insert into ttest values(? , ?)",
ECPGt_double,&(data0),1L,1L,sizeof(double),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
ECPGt_varchar,&(ttest2.bla1),200L,1L,sizeof(struct
ttest2_::varchar_bla1),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);}

.............

If you know how this problem might be fixed, list the solution below:
---------------------------------------------------------------------

Browse pgsql-bugs by date

  From Date Subject
Next Message Denis N. Stepanov 2000-04-13 16:59:14 Beta5 on Linux Alpha
Previous Message Fabienne Leclere 2000-04-13 08:28:33 ECPGdo