Skip site navigation (1) Skip section navigation (2)

Re: Retrieving points, arrays, ... with libpq

From: Jeroen Vermeulen <jtv(at)xs4all(dot)nl>
To: Georges(dot)Brefort(at)sanofi-aventis(dot)com
Cc: pgsql-interfaces(at)postgresql(dot)org
Subject: Re: Retrieving points, arrays, ... with libpq
Date: 2008-10-22 05:27:28
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-interfaces
Georges(dot)Brefort(at)sanofi-aventis(dot)com wrote:

> I have read the most recent documentation from the first to the very
> last line, and I guess I can retreive data of any type with the
> PQgetValue() function,  something like: 
> char* chunkOfMemory = PQgetvalue( (const PGresult*) myresult,
> row_number, column_number);
> But then, is it possible to cast the char* pointer to some meaningfull C
> structure if column_number relates to some datatype other than text or
> integer ?

By default, you get your data in a textual representation.  So you need 
to parse the string that that char* points to.  (It's also possible to 
work in binary mode, but then you've got a lot more worries about 
portability and such for not much gain in speed.)


In response to

pgsql-interfaces by date

Next:From: Joe HalpinDate: 2008-10-28 19:34:41
Subject: Problem with trigger function in C
Previous:From: Georges.BrefortDate: 2008-10-20 15:06:25
Subject: Retrieving points, arrays, ... with libpq

Privacy Policy | About PostgreSQL
Copyright © 1996-2018 The PostgreSQL Global Development Group