Search Postgresql Archives

Writing SRF

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux