ecpg aborts with structure reference

From: Tim Nelson <TNELSON(at)ECS-INC(dot)com>
To: "'pgsql-interfaces(at)postgresql(dot)org'" <pgsql-interfaces(at)postgresql(dot)org>
Subject: ecpg aborts with structure reference
Date: 2002-01-11 12:29:28
Message-ID: 63BD6AB4FBBED411B3E20004ACAE8B6301445B@str_nt01.ecs-inc.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

Browse pgsql-interfaces by date

  From Date Subject
Next Message glos 2002-01-11 13:12:46 How to get oid of newly inserted row with JDBC?
Previous Message Christof Petig 2002-01-11 09:10:13 ECPG bug: allocate descriptor does not clear sqlcode