dbTalk Databases Forums  

[BUGS] ecpg mapping struct members for indicators incorrectly?

mailing.database.pgsql-bugs mailing.database.pgsql-bugs


Discuss [BUGS] ecpg mapping struct members for indicators incorrectly? in the mailing.database.pgsql-bugs forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Shelby Cain
 
Posts: n/a

Default [BUGS] ecpg mapping struct members for indicators incorrectly? - 02-19-2004 , 01:58 PM






I'm coming from a Pro*C background so I'm not entirely
certain whether what I am attempting is simply not
allowed in ecpg or not.

ecpg --version
ecpg (PostgreSQL 7.4.1) 3.1.0

showbug.pgc
------------------------------------------
#define HOSTSIZE 100

exec sql begin declare section;

typedef struct _my_host_t {
char field1[HOSTSIZE][20];
int field2[HOSTSIZE];
} _my_host_ary_t;

typedef struct _my_host_ind_t {
int field1_ind[HOSTSIZE];
int field2_ind[HOSTSIZE];
} _my_host_ind_ary_t;

exec sql end declare section;

exec sql declare my_cur cursor for select field1,
field2 from sometable;

int main()
{
exec sql begin declare section;

_my_host_ary_t *mydata;
_my_host_ind_ary_t *myind;
int fetchsize;

exec sql end declare section;

fetchsize = HOSTSIZE;

exec sql fetch :fetchsize from my_cur into :mydata
INDICATOR :myind;

}
------------------------------------------

After running ecpg -o showbug.c showbug.pgc the
section of interest in the generated .c file is:

showbug.c
------------------------------------------
/* Processed by ecpg (3.1.0) */

[...]

int main()
{
/* exec sql begin declare section */

[...]

{ ECPGdo(__LINE__, 0, 1, NULL, "fetch ? from
my_cur",

ECPGt_int,&(vArySize),(long)1,(long)1,sizeof(int),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
ECPGt_EOIT,

ECPGt_char,(mydata->field1),(long)20,(long)HOSTSIZE,20*sizeof(char) ,

ECPGt_int,(mydata->field1_ind),(long)1,(long)HOSTSIZE,sizeof(int),

ECPGt_int,(mydata->field2),(long)1,(long)HOSTSIZE,sizeof(int),


ECPGt_int,(mydata->field2_ind),(long)1,(long)HOSTSIZE,sizeof(int),
ECPGt_EORT);}

[...]

}

You can see that ecpg incorrectly mapped the indicator
fields field1_ind and field2_ind to the mydata struct
instead of myind which will cause a compile error.

Regards,

Shelby Cain



__________________________________
Do you Yahoo!?
Yahoo! Mail SpamGuard - Read only the mail you want.
http://antispam.yahoo.com/tools

---------------------------(end of broadcast)---------------------------
TIP 7: don't forget to increase your free space map settings

Reply With Quote
  #2  
Old   
Michael Meskes
 
Posts: n/a

Default Re: [BUGS] ecpg mapping struct members for indicators incorrectly? - 02-23-2004 , 12:17 PM






On Thu, Feb 19, 2004 at 11:57:33AM -0800, Shelby Cain wrote:
Quote:
I'm coming from a Pro*C background so I'm not entirely
certain whether what I am attempting is simply not
allowed in ecpg or not.
Well it should be. :-)

Thanks for reporting the bug. I just committed a fix to HEAD and
REL7_4_STABLE so it should be in 7.4.2.

Michael

--
Michael Meskes
Email: Michael at Fam-Meskes dot De
ICQ: 179140304, AIM/Yahoo: michaelmeskes, Jabber: meskes (AT) jabber (DOT) org
Go SF 49ers! Go Rhein Fire! Use Debian GNU/Linux! Use PostgreSQL!

---------------------------(end of broadcast)---------------------------
TIP 7: don't forget to increase your free space map settings


Reply With Quote
  #3  
Old   
Shelby Cain
 
Posts: n/a

Default Re: [BUGS] ecpg mapping struct members for indicators incorrectly? - 02-25-2004 , 10:24 PM



--- Michael Meskes <meskes (AT) postgresql (DOT) org> wrote:
Quote:
On Thu, Feb 19, 2004 at 11:57:33AM -0800, Shelby
Cain wrote:
I'm coming from a Pro*C background so I'm not
entirely
certain whether what I am attempting is simply not
allowed in ecpg or not.

Well it should be. :-)

Thanks for reporting the bug. I just committed a fix
to HEAD and
REL7_4_STABLE so it should be in 7.4.2.

No problem. Thanks for the quick response.

__________________________________
Do you Yahoo!?
Get better spam protection with Yahoo! Mail.
http://antispam.yahoo.com/tools

---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.