Re: Reading from a REFCURSOR in a C language function

From: Vlad Arkhipov <arhipov(at)dc(dot)baikal(dot)ru>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Reading from a REFCURSOR in a C language function
Date: 2011-04-06 05:31:06
Message-ID: 4D9BFA9A.2050200@dc.baikal.ru
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

06.04.2011 02:06, Jan Wieck wrote:
> On 4/5/2011 3:24 AM, Vlad Arkhipov wrote:
>> Hi,
>>
>> I'm trying to write a C language function that has a REFCURSOR argument.
>> Could anyone please give me an example of reading from a cursor in C
>> code?
>>
>
> Sorry, I don't have a code example.
>
> A refcursor data type is basically a string, containing the name of an
> open cursor (portal). It is stored binary compatible to the text data
> type. In the C function, you extract that name (using the textout
> function) and use it inside the FETCH query as the cursor name. You
> may need to double-quote that string.
>
>
> Jan
>
Thanks for the hint. It works great.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Pavel Golub 2011-04-06 06:26:59 Re: Please review test report form
Previous Message Oleg Bartunov 2011-04-06 05:00:55 Re: GSoC proposal: Fast GiST index build