Re: How do you convert PostgreSQL internal binary field to C datatypes

From: "Jeroen T(dot) Vermeulen" <jtv(at)xs4all(dot)nl>
To: "Jeff Lynn" <jmlynn(at)rogers(dot)com>
Cc: pgsql-interfaces(at)postgresql(dot)org
Subject: Re: How do you convert PostgreSQL internal binary field to C datatypes
Date: 2007-05-23 19:35:31
Message-ID: 23494.125.24.219.252.1179948931.squirrel@webmail.xs4all.nl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Browse pgsql-interfaces by date

  From Date Subject
Next Message Andrew McNamara 2007-05-23 23:12:28 Re: How do you convert PostgreSQL internal binary field to C datatypes
Previous Message Reid Thompson 2007-05-23 16:19:44 Re: How do you convert PostgreSQL internal binary field to C datatypes