ECPG pointer vs array

Поиск
Список
Период
Сортировка
От Boszormenyi Zoltan
Тема ECPG pointer vs array
Дата
Msg-id 4BB309B9.3030909@cybertec.at
обсуждение исходный текст
Ответ на Re: Problems with variable cursorname in ecpg  (Boszormenyi Zoltan <zb@cybertec.at>)
Ответы Re: ECPG pointer vs array  (Michael Meskes <meskes@postgresql.org>)
Список pgsql-hackers
Hi,

It would be good if libecpg to support e.g. "char **strings" instead of
"char *strings[]" for preallocated strings and the array of those.
IIRC, the first version overwrote my stack in a test programme, as these
two are treated the same but they are not.

Also, as "numeric" is supposed to be allocated using PGTYPESnumeric_new(),
we would need to support array of pointers to numeric, as well as the
current
static array of numerics. There's no way PGTYPESnumeric_free() works
on a static array, e.g. glibc will abort the app with a debug output of
free() on
an invalid pointer. Freeing the "digit" pointer manually is ugly,
numeric has
accessor functions, after all. Not doing anything leads to a memory leak.
Somehow digitbuf_free() should be make visible outside for such static
numeric variables.

These and other types came up regarding problems with "FETCH N"
in ECPG. All boils down to the same problem: "sometype *ptr" is
not equivalent to "sometype ptr[]" if you use &ptr, which is used
by ECPG in most cases.

Best regards,
Zoltán Böszörményi

-- 
Bible has answers for everything. Proof:
"But let your communication be, Yea, yea; Nay, nay: for whatsoever is more
than these cometh of evil." (Matthew 5:37) - basics of digital technology.
"May your kingdom come" - superficial description of plate tectonics

----------------------------------
Zoltán Böszörményi
Cybertec Schönig & Schönig GmbH
http://www.postgresql.at/



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Boszormenyi Zoltan
Дата:
Сообщение: Re: Problems with variable cursorname in ecpg
Следующее
От: Fujii Masao
Дата:
Сообщение: Re: pending patch: Re: HS/SR and smart shutdown