ecpg mapping struct members for indicators incorrectly?

Поиск
Список
Период
Сортировка
От Shelby Cain
Тема ecpg mapping struct members for indicators incorrectly?
Дата
Msg-id 20040219195733.45089.qmail@web41610.mail.yahoo.com
обсуждение исходный текст
Ответы Re: ecpg mapping struct members for indicators incorrectly?  (Michael Meskes <meskes@postgresql.org>)
Список pgsql-bugs
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

В списке pgsql-bugs по дате отправления:

Предыдущее
От: "Roopali Sharma"
Дата:
Сообщение: pg_restore problems
Следующее
От: wade
Дата:
Сообщение: