Writing SRF

Поиск
Список
Период
Сортировка
Искать
От
Jorge Arevalo
Тема
Writing SRF
Дата
Msg-id
t2ld321138e1004280926n703e7379t7508b5f19402d815@mail.gmail.com
Список
Дерево обсуждения
Writing SRF Jorge Arevalo <jorgearevalo@gis4free.org>
Re: Writing SRF Tom Lane <tgl@sss.pgh.pa.us>
Re: Writing SRF Jorge Arevalo <jorgearevalo@gis4free.org>
Re: Writing SRF Tom Lane <tgl@sss.pgh.pa.us>
Re: Writing SRF Jorge Arevalo <jorgearevalo@gis4free.org>
Re: Writing SRF Tom Lane <tgl@sss.pgh.pa.us>
Re: Writing SRF Jorge Arevalo <jorgearevalo@gis4free.org>
Re: Writing SRF Tom Lane <tgl@sss.pgh.pa.us>
Re: Writing SRF Jorge Arevalo <jorgearevalo@gis4free.org>
Re: Writing SRF Martin Gainty <mgainty@hotmail.com>
Re: Writing SRF Jorge Arevalo <jorgearevalo@gis4free.org>
Hello,

I'm writing a SRF following the example from
http://www.postgresql.org/docs/8.4/interactive/xfunc-c.html (section
34.9.10). In the example, in the code executed in first call, we get
the number of tuples to be returned, and no more. Then, in each call,
a new tuple is allocated and returned, until reach max_calls.

My problem is I want to return an array of structs, and that array is
returned (as a pointer) by an external function. I can call that
funcion in first call, and then store a the returned array in
funcctx->user_fctx. In successive calls, I can get one new element of
the array pointed by user_fctx, but I'd need the number of elements
(the classical problem "how to get the number of elements of a
dinamically allocated array").

Would the best way to modify the external function to get, somehow,
the number of structs returned? Is there any better way to do what I
need?

Thanks in advance, and best regards
Jorge

----
http://www.gis4free.org/blog
В списке pgsql-general по дате отправления
От: Jasen Betts
Дата:
От: sunpeng
Дата:
FAQ