Re: How do you convert PostgreSQL internal binary field to C datatypes - Mailing list pgsql-interfaces

From Jeroen T. Vermeulen
Subject Re: How do you convert PostgreSQL internal binary field to C datatypes
Date
Msg-id 23494.125.24.219.252.1179948931.squirrel@webmail.xs4all.nl
Whole thread Raw
In response to Re: How do you convert PostgreSQL internal binary field to C datatypes  (Jeff Lynn <jmlynn@rogers.com>)
List pgsql-interfaces
On Wed, May 23, 2007 22:47, Jeff Lynn wrote:

> So I gave up.   I will not use PostgreSQL until there is a simple way to
> extract data directly into C or C++ data type.  Is one expect to fetch
> data in text, then use text to int, text to double, text to date
> function before you can make any business logic works?

If you're working in C++ (as opposed to C, which I for one thought you
were using) then it's really easy.  As one example of the C++ API, if you
have a result set "data" and you want to extract an integer value at row
r, column c:
 int x = data[r][c].as<int>();

See http://pqxx.org/ for more on the C++ API.


Jeroen




pgsql-interfaces by date:

Previous
From: Reid Thompson
Date:
Subject: Re: How do you convert PostgreSQL internal binary field to C datatypes
Next
From: Andrew McNamara
Date:
Subject: Re: How do you convert PostgreSQL internal binary field to C datatypes