Re: Reading from a REFCURSOR in a C language function - Mailing list pgsql-hackers

From Jan Wieck
Subject Re: Reading from a REFCURSOR in a C language function
Date
Msg-id 4D9B4C01.5000107@Yahoo.com
Whole thread Raw
In response to Reading from a REFCURSOR in a C language function  (Vlad Arkhipov <arhipov@dc.baikal.ru>)
Responses Re: Reading from a REFCURSOR in a C language function  (Vlad Arkhipov <arhipov@dc.baikal.ru>)
List 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


pgsql-hackers by date:

Previous
From: Robert Haas
Date:
Subject: Re: Re: synchronous_commit and synchronous_replication Re: [COMMITTERS] pgsql: Efficient transaction-controlled synchronous replication.
Next
From: Peter Eisentraut
Date:
Subject: Re: Re: [COMMITTERS] pgsql: Support comments on FOREIGN DATA WRAPPER and SERVER objects.