ecpg aborts with structure reference - Mailing list pgsql-interfaces

From Tim Nelson
Subject ecpg aborts with structure reference
Date
Msg-id 63BD6AB4FBBED411B3E20004ACAE8B6301445B@str_nt01.ecs-inc.com
Whole thread Raw
List pgsql-interfaces
I've found this problem with "ecpg" (I even tried moving up to version 2.9)
where the code:

exec sql include    sqlca;

exec sql type  APC_LAYO_FLD is struct {  long apcl_id;  char apclf_sect_flg[2];
};

exec sql type  APC_LAYOUT is struct {  long apcl_id;
};

exec sql begin declare section;  APC_LAYOUT     PL;  APC_LAYO_FLD   PLF;
exec sql end declare section;
  int
print_template()
{
exec sql begin declare section;  char curr_sect[5];
exec sql end declare section;
  if (1) {        exec sql declare fld_curs cursor for           select apc_layo_fld.*              from apc_layo_fld
          where apcl_id = :PL.apcl_id                and apclf_sect_flg = :curr_sect           order by apclf_ln_nbr,
apclf_col_nbr; }     exec sql open fld_curs;
 
}

If I remove the "if", or change the structure reference ":PL.apcl_id" to
a constant it doesn't abort.  I think this has something to with the
"open" being outside of the block. I try and dig into the code a bit as time
permits.  Thanks.

Tim Nelson


pgsql-interfaces by date:

Previous
From: Christof Petig
Date:
Subject: ECPG bug: allocate descriptor does not clear sqlcode
Next
From: Christof Petig
Date:
Subject: Re: ECPG bug: allocate descriptor does not clear sqlcode