pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
BUG #5762: ecpg
2+ messages / 2 participants
[nested] [flat]

* BUG #5762: ecpg
@ 2010-11-22 15:41  Joaquim Salles <joaquimsalles@gmail.com>
  0 siblings, 1 reply; 2+ messages in thread

From: Joaquim Salles @ 2010-11-22 15:41 UTC (permalink / raw)
  To: pgsql-bugs


The following bug has been logged online:

Bug reference:      5762
Logged by:          Joaquim Salles
Email address:      joaquimsalles@gmail.com
PostgreSQL version: 1.8.3
Operating system:   linux - Centos 5.3
Description:        ecpg
Details: 

I'm porting  a pro * c (oracle) to ecpg.

In oracle I have:

 EXEC SQL BEGIN DECLARE SECTION;

 typedef struct _SItemInfo
 {
     varchar strNome [40 +1];

 SItemInfo};

 SItemInfo sitem;

 EXEC SQL END DECLARE SECTION;


  EXEC SQL SELECT name INTO: FROM sitem delivery;

it generates the source and compile c normally. However when I generate in
ecpg have:


 typedef struct {_SItemInfo
# Line 509 "/ home / Development / Delivery / gserv.pgc"
  varchar_strNome_509 struct {int len; char arr [40 + 1];} strNome;
 SItemInfo};

# Line 511 "/ home / Development / Delivery / gserv.pgc"


# Line 513 "/ home / Development / Delivery / gserv.pgc"
 SItemInfo sitem;
/ * Exec sql end declare section * /
# Line 515 "/ home / Development / Delivery / gserv.pgc"



  {ECPGdo (__LINE__, 0, 1, NULL, 0, ECPGst_normal "select name
from delivery, "ECPGt_EOIT,
       ECPGt_varchar, & (sItem.strNome), (long) 40 + 1, (long) 1, sizeof
(struct
varchar_strNome_509)
       ECPGt_NO_INDICATOR, NULL, 0L, 0L, 0L, ECPGt_EORT);}
# Line 518 "/ home / Development / Delivery / gserv.ppc

At C code does not exist in the structure sizeof (struct
varchar_strNome_509) because
she 'and a member of struct SItemInfo in the above case.

Workaround: use "char" instead "varchar".

Thanks

Joaquim Salles



^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: BUG #5762: ecpg
@ 2010-11-29 10:55  Michael Meskes <meskes@postgresql.org>
  parent: Joaquim Salles <joaquimsalles@gmail.com>
  0 siblings, 0 replies; 2+ messages in thread

From: Michael Meskes @ 2010-11-29 10:55 UTC (permalink / raw)
  To: Joaquim Salles <joaquimsalles@gmail.com>; +Cc: pgsql-bugs

On Mon, Nov 22, 2010 at 03:41:06PM +0000, Joaquim Salles wrote:
> In oracle I have:
> 
>  EXEC SQL BEGIN DECLARE SECTION;
> 
>  typedef struct _SItemInfo
>  {
>      varchar strNome [40 +1];
> 
>  SItemInfo};

This seems to have the order reversed. Shouldn't it be 
} SItemInfo; ?

>   EXEC SQL SELECT name INTO: FROM sitem delivery;

Dito here..

> At C code does not exist in the structure sizeof (struct
> varchar_strNome_509) because
> she 'and a member of struct SItemInfo in the above case.

Sorry but I do not understand what you're saying here.

Michael

-- 
Michael Meskes
Michael at Fam-Meskes dot De, Michael at Meskes dot (De|Com|Net|Org)
Michael at BorussiaFan dot De, Meskes at (Debian|Postgresql) dot Org
Jabber: michael.meskes at googlemail dot com
VfL Borussia! Força Barça! Go SF 49ers! Use Debian GNU/Linux, PostgreSQL



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2010-11-29 10:55 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2010-11-22 15:41 BUG #5762: ecpg Joaquim Salles <joaquimsalles@gmail.com>
2010-11-29 10:55 ` Michael Meskes <meskes@postgresql.org>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox