Thread: Read Cursor to C
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? Thank you for the help, /******************************************\ * Gabriel da Silva Beletti * * ------------------------ * * Ciências da Computação * * Computing Science * * * * UNIVERSIDADE FEDERAL DE SANTA CATARINA * * FEDERAL UNIVERSITY OF SANTA CATARINA * * * * Site..: http://www.inf.ufsc.br/~gbeletti * * E-mail: gbeletti@inf.ufsc.br * * UIN : 119620783 * \******************************************/ _______________________________________________________________________ Yahoo! Mail O melhor e-mail gratuito da internet: 6MB de espaço, antivírus, acesso POP3, filtro contra spam. http://br.mail.yahoo.com/
> > > 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