Skip site navigation (1) Skip section navigation (2)

BUG #5762: ecpg

From: "Joaquim Salles" <joaquimsalles(at)gmail(dot)com>
To: pgsql-bugs(at)postgresql(dot)org
Subject: BUG #5762: ecpg
Date: 2010-11-22 15:41:06
Message-ID: 201011221541.oAMFf6KA058520@wwwmaster.postgresql.org (view raw or flat)
Thread:
Lists: pgsql-bugs
The following bug has been logged online:

Bug reference:      5762
Logged by:          Joaquim Salles
Email address:      joaquimsalles(at)gmail(dot)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

Responses

pgsql-bugs by date

Next:From: Tom LaneDate: 2010-11-22 16:20:09
Subject: Re: BUG #5761: In 'dblink' function connection string truncated
Previous:From: dpDate: 2010-11-22 08:04:03
Subject: BUG #5761: In 'dblink' function connection string truncated

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group