ecpg with indicators not working - Mailing list pgsql-interfaces

From James Thompson
Subject ecpg with indicators not working
Date
Msg-id Pine.LNX.4.10.9902162055270.866-100000@hobbes.math.ksu.edu
Whole thread Raw
In response to Re: [INTERFACES] question on accessing PostgreSQL with C  (hoelc <hoelc@pd.jaring.my>)
Responses Re: ecpg with indicators not working
List pgsql-interfaces
From a previous email

> > >     exec sql
> > >       insert into customer(id,name_first,name_middle,name_last,company,
> > >                       address1,address2,city,state,country,zip,phone_work,
> > >                       phone_home,phone_fax,email,date_entered,billing_terms,
> > >                            confirmation_method)
> > >       values (:id,:name_first, :name_middle, :name_last,
> > >               :company,:address1,:address2,
> > >               :city,:state,:country,:zip,:phone_work,
> > >               :phone_home,:phone_fax,:email,date('now'),
> > >               :billing_terms,
> > >               :confirmation_method);
> >
> > Xou can even add indicators like in
> >
> > ... values (:id,:name_first, :name_middle:nm_ind, :name_last, ...
> >

I tried the following (screwed up spacing due to pine autowrap :-)

    exec sql
      insert into
    customer(uid,id,name_first,name_middle,name_last,company,

    address1,address2,city,state,country,zip,phone_work,

    phone_home,phone_fax,email,date_entered,billing_terms,
                           confirmation_method)
      values (:uid,:uid:id_n,:name_first:name_first_n,
              :name_middle:name_middle_n, :name_last:name_last_n,
              :company:company_n,:address1:address1_n,
              :address2:address2_n,:city:city_n,:state:state_n,
              :country:country_n,:zip:zip_n,:phone_work:phone_work_n,

    :phone_home:phone_home_n,:phone_fax:phone_fax_n,:email:email_n,
              date('now'),:billing_terms:billing_terms_n,
              :confirmation_method:confirmation_method_n);


Adding the indicators to the above statement causes ecpg(from the 6.4.2
distro) to seg fault while processing the statement.  I defined each
indicator as the original var name with _n added to the end.  I tried
type int and long.  The statement preprocesses fine without the indicator
vars.

I dont know the proper method for looking into core files but by trial and
error I got gdb to produce (is this correct way to do this?)

[jamest@calvin obelib]$ gdb ecpg  core
GNU gdb 4.17
Copyright 1998 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you
are welcome to change it and/or distribute copies of it under certain
conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for
details.
This GDB was configured as "i386-redhat-linux"...
Core was generated by `ecpg customer.ec'.
Program terminated with signal 11, Segmentation fault.
find_solib: Can't read pathname for load map: Input/output error

#0  0x8054d81 in ECPGdump_a_type ()
(gdb) bt
#0  0x8054d81 in ECPGdump_a_type ()
#1  0x8049973 in dump_variables ()
#2  0x8049941 in dump_variables ()
#3  0x8049941 in dump_variables ()
#4  0x8049941 in dump_variables ()
#5  0x8049941 in dump_variables ()
#6  0x8049941 in dump_variables ()
#7  0x8049941 in dump_variables ()
#8  0x8049941 in dump_variables ()
#9  0x8049941 in dump_variables ()
#10 0x8049941 in dump_variables ()
#11 0x8049941 in dump_variables ()
#12 0x8049941 in dump_variables ()
#13 0x8049941 in dump_variables ()
#14 0x8049941 in dump_variables ()
#15 0x8049941 in dump_variables ()
#16 0x8049941 in dump_variables ()
#17 0x8049941 in dump_variables ()
#18 0x8049fe7 in output_statement ()
#19 0x804b91b in yyparse ()
#20 0x8055475 in main ()

Does anyone have a working example of using indicator vars with ecpg?
Thanks.

->->->->->->->->->->->->->->->->->->---<-<-<-<-<-<-<-<-<-<-<-<-<-<-<-<-<-<
James Thompson    138 Cardwell Hall  Manhattan, Ks   66506    785-532-0561
Kansas State University                          Department of Mathematics
->->->->->->->->->->->->->->->->->->---<-<-<-<-<-<-<-<-<-<-<-<-<-<-<-<-<-<




pgsql-interfaces by date:

Previous
From: Vince DiCiero
Date:
Subject: RE: [INTERFACES] Methods for stepping through results?
Next
From: Kirill Sapelkin
Date:
Subject: gnu readline