ECPGdump_a_simple(o, name,
type->u.element->type,
- type->u.element->size, type->size, NULL, prefix, type->u.element->counter);
+ type->u.element->size, type->size, struct_sizeof ? struct_sizeof : NULL,
+ prefix, type->u.element->counter);
if (ind_type != NULL)
{
sprintf(offset, "sizeof(%s)", ecpg_type_name(type));
break;
}
-
- if (atoi(arrsize) < 0)
+
+ /*
+ * Array size would be -1 for addresses of members within structure,
+ * when pointer to structure is being dumped.
+ */
+ if (atoi(arrsize) < 0 && !siz)
strcpy(arrsize, "1");
- if (siz == NULL || strlen(siz) == 0 || strcmp(arrsize, "0") == 0 || strcmp(arrsize, "1") == 0)
+ /*
+ * If siz i.e. the size of structure of which this variable is part of,
+ * that gives the offset to the next element, if required
+ */
+ if (siz == NULL || strlen(siz) == 0)
fprintf(o, "\n\t%s,%s,(long)%s,(long)%s,%s, ", get_type(type), variable, varcharsize, arrsize, offset);
else
fprintf(o, "\n\t%s,%s,(long)%s,(long)%s,%s, ", get_type(type), variable, varcharsize, arrsize, siz);
}
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select * from customers limit 1", ECPGt_EOIT,
- ECPGt_varchar,&(custs4.name),(long)50,(long)1,sizeof(struct varchar_4),
- ECPGt_short,&(inds[0].name_ind),(long)1,(long)1,sizeof(short),
- ECPGt_int,&(custs4.phone),(long)1,(long)1,sizeof(int),
- ECPGt_short,&(inds[0].phone_ind),(long)1,(long)1,sizeof(short), ECPGt_EORT);
+ ECPGt_varchar,&(custs4.name),(long)50,(long)1,sizeof( struct customer4 ),
+ ECPGt_short,&(inds[0].name_ind),(long)1,(long)1,sizeof( struct ind ),
+ ECPGt_int,&(custs4.phone),(long)1,(long)1,sizeof( struct customer4 ),
+ ECPGt_short,&(inds[0].phone_ind),(long)1,(long)1,sizeof( struct ind ), ECPGt_EORT);
#line 80 "array_of_struct.pgc"
if (sqlca.sqlcode == ECPG_NOT_FOUND) sqlprint();
open_cur1(void)
{
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare mycur cursor for select * from a1", ECPGt_EOIT,
- ECPGt_int,&((*( MYTYPE *)(ECPGget_var( 0)) ).id),(long)1,(long)1,sizeof(int),
- ECPGt_int,&((*( MYNULLTYPE *)(ECPGget_var( 1)) ).id),(long)1,(long)1,sizeof(int),
- ECPGt_char,&((*( MYTYPE *)(ECPGget_var( 0)) ).t),(long)64,(long)1,(64)*sizeof(char),
- ECPGt_int,&((*( MYNULLTYPE *)(ECPGget_var( 1)) ).t),(long)1,(long)1,sizeof(int),
- ECPGt_double,&((*( MYTYPE *)(ECPGget_var( 0)) ).d1),(long)1,(long)1,sizeof(double),
- ECPGt_int,&((*( MYNULLTYPE *)(ECPGget_var( 1)) ).d1),(long)1,(long)1,sizeof(int),
- ECPGt_double,&((*( MYTYPE *)(ECPGget_var( 0)) ).d2),(long)1,(long)1,sizeof(double),
- ECPGt_int,&((*( MYNULLTYPE *)(ECPGget_var( 1)) ).d2),(long)1,(long)1,sizeof(int),
- ECPGt_char,&((*( MYTYPE *)(ECPGget_var( 0)) ).c),(long)30,(long)1,(30)*sizeof(char),
- ECPGt_int,&((*( MYNULLTYPE *)(ECPGget_var( 1)) ).c),(long)1,(long)1,sizeof(int), ECPGt_EORT);
+ ECPGt_int,&((*( MYTYPE *)(ECPGget_var( 0)) ).id),(long)1,(long)1,sizeof( struct mytype ),
+ ECPGt_int,&((*( MYNULLTYPE *)(ECPGget_var( 1)) ).id),(long)1,(long)1,sizeof( struct mynulltype ),
+ ECPGt_char,&((*( MYTYPE *)(ECPGget_var( 0)) ).t),(long)64,(long)1,sizeof( struct mytype ),
+ ECPGt_int,&((*( MYNULLTYPE *)(ECPGget_var( 1)) ).t),(long)1,(long)1,sizeof( struct mynulltype ),
+ ECPGt_double,&((*( MYTYPE *)(ECPGget_var( 0)) ).d1),(long)1,(long)1,sizeof( struct mytype ),
+ ECPGt_int,&((*( MYNULLTYPE *)(ECPGget_var( 1)) ).d1),(long)1,(long)1,sizeof( struct mynulltype ),
+ ECPGt_double,&((*( MYTYPE *)(ECPGget_var( 0)) ).d2),(long)1,(long)1,sizeof( struct mytype ),
+ ECPGt_int,&((*( MYNULLTYPE *)(ECPGget_var( 1)) ).d2),(long)1,(long)1,sizeof( struct mynulltype ),
+ ECPGt_char,&((*( MYTYPE *)(ECPGget_var( 0)) ).c),(long)30,(long)1,sizeof( struct mytype ),
+ ECPGt_int,&((*( MYNULLTYPE *)(ECPGget_var( 1)) ).c),(long)1,(long)1,sizeof( struct mynulltype ), ECPGt_EORT);
#line 40 "outofscope.pgc"
if (sqlca.sqlcode < 0) exit (1);}
get_record1(void)
{
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch mycur", ECPGt_EOIT,
- ECPGt_int,&((*( MYTYPE *)(ECPGget_var( 0)) ).id),(long)1,(long)1,sizeof(int),
- ECPGt_int,&((*( MYNULLTYPE *)(ECPGget_var( 1)) ).id),(long)1,(long)1,sizeof(int),
- ECPGt_char,&((*( MYTYPE *)(ECPGget_var( 0)) ).t),(long)64,(long)1,(64)*sizeof(char),
- ECPGt_int,&((*( MYNULLTYPE *)(ECPGget_var( 1)) ).t),(long)1,(long)1,sizeof(int),
- ECPGt_double,&((*( MYTYPE *)(ECPGget_var( 0)) ).d1),(long)1,(long)1,sizeof(double),
- ECPGt_int,&((*( MYNULLTYPE *)(ECPGget_var( 1)) ).d1),(long)1,(long)1,sizeof(int),
- ECPGt_double,&((*( MYTYPE *)(ECPGget_var( 0)) ).d2),(long)1,(long)1,sizeof(double),
- ECPGt_int,&((*( MYNULLTYPE *)(ECPGget_var( 1)) ).d2),(long)1,(long)1,sizeof(int),
- ECPGt_char,&((*( MYTYPE *)(ECPGget_var( 0)) ).c),(long)30,(long)1,(30)*sizeof(char),
- ECPGt_int,&((*( MYNULLTYPE *)(ECPGget_var( 1)) ).c),(long)1,(long)1,sizeof(int), ECPGt_EORT);
+ ECPGt_int,&((*( MYTYPE *)(ECPGget_var( 0)) ).id),(long)1,(long)1,sizeof( struct mytype ),
+ ECPGt_int,&((*( MYNULLTYPE *)(ECPGget_var( 1)) ).id),(long)1,(long)1,sizeof( struct mynulltype ),
+ ECPGt_char,&((*( MYTYPE *)(ECPGget_var( 0)) ).t),(long)64,(long)1,sizeof( struct mytype ),
+ ECPGt_int,&((*( MYNULLTYPE *)(ECPGget_var( 1)) ).t),(long)1,(long)1,sizeof( struct mynulltype ),
+ ECPGt_double,&((*( MYTYPE *)(ECPGget_var( 0)) ).d1),(long)1,(long)1,sizeof( struct mytype ),
+ ECPGt_int,&((*( MYNULLTYPE *)(ECPGget_var( 1)) ).d1),(long)1,(long)1,sizeof( struct mynulltype ),
+ ECPGt_double,&((*( MYTYPE *)(ECPGget_var( 0)) ).d2),(long)1,(long)1,sizeof( struct mytype ),
+ ECPGt_int,&((*( MYNULLTYPE *)(ECPGget_var( 1)) ).d2),(long)1,(long)1,sizeof( struct mynulltype ),
+ ECPGt_char,&((*( MYTYPE *)(ECPGget_var( 0)) ).c),(long)30,(long)1,sizeof( struct mytype ),
+ ECPGt_int,&((*( MYNULLTYPE *)(ECPGget_var( 1)) ).c),(long)1,(long)1,sizeof( struct mynulltype ), ECPGt_EORT);
#line 49 "outofscope.pgc"
if (sqlca.sqlcode < 0) exit (1);}
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select idnum , name , accs , string1 , string2 , string3 from empl where idnum = $1 ",
ECPGt_long,&(empl.idnum),(long)1,(long)1,sizeof(long),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT,
- ECPGt_long,&(empl.idnum),(long)1,(long)1,sizeof(long),
+ ECPGt_long,&(empl.idnum),(long)1,(long)1,sizeof( struct TBempl ),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
- ECPGt_char,&(empl.name),(long)21,(long)1,(21)*sizeof(char),
+ ECPGt_char,&(empl.name),(long)21,(long)1,sizeof( struct TBempl ),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
- ECPGt_short,&(empl.accs),(long)1,(long)1,sizeof(short),
+ ECPGt_short,&(empl.accs),(long)1,(long)1,sizeof( struct TBempl ),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
ECPGt_char,(str),(long)11,(long)1,(11)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
while (1) {
strcpy(msg, "fetch");
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch cur", ECPGt_EOIT,
- ECPGt_varchar,&(p->name),(long)BUFFERSIZ,(long)1,sizeof(struct varchar_1),
- ECPGt_int,&(i->ind_name),(long)1,(long)1,sizeof(int),
- ECPGt_long,&(p->birth.born),(long)1,(long)1,sizeof(long),
- ECPGt_long,&(i->ind_birth.born),(long)1,(long)1,sizeof(long),
- ECPGt_short,&(p->birth.age),(long)1,(long)1,sizeof(short),
- ECPGt_short,&(i->ind_birth.age),(long)1,(long)1,sizeof(short),
+ ECPGt_varchar,&(p->name),(long)BUFFERSIZ,(long)-1,sizeof( struct birthinfo ),
+ ECPGt_int,&(i->ind_name),(long)1,(long)-1,sizeof( struct birthinfo ),
+ ECPGt_long,&(p->birth.born),(long)1,(long)1,sizeof( struct birthinfo ),
+ ECPGt_long,&(i->ind_birth.born),(long)1,(long)1,sizeof( struct birthinfo ),
+ ECPGt_short,&(p->birth.age),(long)1,(long)1,sizeof( struct birthinfo ),
+ ECPGt_short,&(i->ind_birth.age),(long)1,(long)1,sizeof( struct birthinfo ),
ECPGt_char,&(married),(long)0,(long)1,(1)*sizeof(char),
ECPGt_long,&(ind_married),(long)1,(long)1,sizeof(long),
ECPGt_int,&(children.integer),(long)1,(long)1,sizeof(int),