agora inbox for pgsql-interfaces@postgresql.org  
help / color / mirror / Atom feed
From: Jeroen Vermeulen <jtv@xs4all.nl>
To: Whit Armstrong <armstrong.whit@gmail.com>
Cc: pgsql-interfaces@postgresql.org
Subject: Re: simple example of copying data from a c/c++ array into postgres
Date: Sat, 20 Dec 2008 23:01:39 +0700
Message-ID: <494D16E3.4030806@xs4all.nl> (raw)
In-Reply-To: <8ec76080812110837y44785948gc9f367740c91071d@mail.gmail.com>
References: <8ec76080812090708g93000f9l7e7f3e2162587331@mail.gmail.com>
	<493EA271.8010209@xs4all.nl>
	<8ec76080812090936g596abf91jdd8a184c3f56c32@mail.gmail.com>
	<49413DE7.8040703@xs4all.nl>
	<8ec76080812110837y44785948gc9f367740c91071d@mail.gmail.com>

Whit Armstrong wrote:
> Thanks, Jeroen.
> 
> just want to make sure I understand the convention for libpq and libpqxx.
> 
> the convention for getting data into postgres is to convert everything
> to strings first?  even if the data is already stored as a 64bit
> double in the client app?

Hi Whit,

Sorry for taking so long; for some reason my mail client doesn't seem 
convinced that I want to know about new mail in this mailbox.

The answer to your question is: yes, that is the default.  If you want 
to transfer binary data, it's still up to you to convert those doubles 
from your client's native format to the right format to transfer them in.

I've never used binary mode myself so I don't know off the top of my 
head what that format is--there's a good chance that all it takes is 
some variant of ntohl() but the details will depend on the architecture, 
OS, and possibly compiler (and/or compiler configuration) you work with.

Which by the way is one reason not to talk binary outside your 
application unless you have to!


Jeroen



view thread (9+ messages)  latest in thread

Message-ID: <494D16E3.4030806@xs4all.nl>
Permalink:  ../494D16E3.4030806@xs4all.nl/
Also on:    postgresql.org/message-id/494D16E3.4030806@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, armstrong.whit@gmail.com
  Subject: Re: simple example of copying data from a c/c++ array into postgres
  In-Reply-To: <494D16E3.4030806@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 agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox