Re: Read Cursor to C - Mailing list pgsql-interfaces

From Christoph Haller
Subject Re: Read Cursor to C
Date
Msg-id 200304291357.PAA02511@rodos
Whole thread Raw
In response to Read Cursor to C  (Gabriel Beletti <gbeletti@yahoo.com.br>)
List pgsql-interfaces
> 
> 
> Hi, my name is Gabriel and I need to read binary data
> from de DB and write it to a file in C. How do I use
> this cursor? Howm do I read the data from the cursor
> after the query is done and write it to C?
> 
Use the libpq interface: 

PQexec(.., "DECLARE <cursorname> BINARY CURSOR FOR <query>")

PQexec(.., "FETCH ALL IN <cursorname>")

PQgetvalue(.., .., ..)

PQexec(.., "CLOSE <cursorname>")

See the doc on libpq for details. 
Regards, Christoph 



pgsql-interfaces by date:

Previous
From: Antonio Giráldez
Date:
Subject:
Next
From: "Haron, Charles"
Date:
Subject: User-defined functions with Kylix/Delphi