pg.ddx.io  pgsql-interfaces@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Jeroen T. Vermeulen <jtv@xs4all.nl>
To: Jeff Lynn <jmlynn@rogers.com>
Cc: pgsql-interfaces@postgresql.org
Subject: Re: How do you convert PostgreSQL internal binary field to C datatypes
Date: Thu, 24 May 2007 02:35:31 +0700 (ICT)
Message-ID: <23494.125.24.219.252.1179948931.squirrel@webmail.xs4all.nl> (raw)
In-Reply-To: <46546220.4060209@rogers.com>
References: <46546220.4060209@rogers.com>

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





view thread (6+ messages)  latest in thread

Message-ID: <23494.125.24.219.252.1179948931.squirrel@webmail.xs4all.nl>
Permalink:  ../23494.125.24.219.252.1179948931.squirrel@webmail.xs4all.nl/
Also on:    postgresql.org/message-id/23494.125.24.219.252.1179948931.squirrel@webmail.xs4all.nl

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-interfaces@postgresql.org
  Cc: jtv@xs4all.nl, jmlynn@rogers.com
  Subject: Re: How do you convert PostgreSQL internal binary field to C datatypes
  In-Reply-To: <23494.125.24.219.252.1179948931.squirrel@webmail.xs4all.nl>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox