Re: Reading from a REFCURSOR in a C language function

From: Jan Wieck <JanWieck(at)Yahoo(dot)com>
To: Vlad Arkhipov <arhipov(at)dc(dot)baikal(dot)ru>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Reading from a REFCURSOR in a C language function
Date: 2011-04-05 17:06:09
Message-ID: 4D9B4C01.5000107@Yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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

--
Anyone who trades liberty for security deserves neither
liberty nor security. -- Benjamin Franklin

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2011-04-05 17:44:12 Re: Re: [COMMITTERS] pgsql: Support comments on FOREIGN DATA WRAPPER and SERVER objects.
Previous Message Robert Haas 2011-04-05 16:37:56 Re: Re: synchronous_commit and synchronous_replication Re: [COMMITTERS] pgsql: Efficient transaction-controlled synchronous replication.