ecpg & host variables
От | Daniel Kelley |
---|---|
Тема | ecpg & host variables |
Дата | |
Msg-id | Pine.BSF.4.20L2.0207191555500.34939-100000@mx1.gc.ny.otec.com обсуждение исходный текст |
Ответы |
Re: ecpg & host variables
Re: ecpg & host variables |
Список | pgsql-interfaces |
hi- i'm looking to convert a pro*c application to something postgresql-based. i've just started to experiment with ecpg, and have been pleasantly surprised that large parts of out existing code will be useable without too much alteration. the problems that i've run into all involve variable declarations. we have a large number of complex structures that map in-house datatypes. with oracle, we could do something like this: -------------------------------------------------------- typedef struct { int id; char name[30]; char dsc[1000]; } rec_t; rec_t r; EXEC SQL SELECT id, name, dsc INTO :r.id, :r.name, :r.dsc FROM table WHERE id = :r.id; -------------------------------------------------------- to make this code work with ecpg, i've made the following changes: -------------------------------------------------------- EXEC SQL BEGIN DECLARE SECTION; typedef struct { int id; char name[30]; char dsc[1000]; } rec_t; rec_t r; EXEC SQL END DECLARE SECTION; -------------------------------------------------------- which yields the following error from ecpg: postgres.pgc:15: ERROR: invalid datatype 'typedef' is there are facility that i might be missing that would allow me to use our existing structures as host variables w/ postgres embedded sql? or am i better off just skipping ecpg and coding directly with libpq? thanks in advance for any insight you can offer. dan
В списке pgsql-interfaces по дате отправления: