Re: simple example of copying data from a c/c++ array into postgres

From: "Whit Armstrong" <armstrong(dot)whit(at)gmail(dot)com>
To: "Jeroen Vermeulen" <jtv(at)xs4all(dot)nl>
Cc: pgsql-interfaces(at)postgresql(dot)org
Subject: Re: simple example of copying data from a c/c++ array into postgres
Date: 2008-12-20 17:18:30
Message-ID: 8ec76080812200918y5144c754sd2d73ad0759c117@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-interfaces

Thanks for you reply. I'll definitely stick to convention.

Cheers,
Whit

On Sat, Dec 20, 2008 at 11:01 AM, Jeroen Vermeulen <jtv(at)xs4all(dot)nl> wrote:
> 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
>

In response to

Browse pgsql-interfaces by date

  From Date Subject
Next Message Thue Janus Kristensen 2008-12-28 12:19:29 Getting a list of prepared statements
Previous Message Jeroen Vermeulen 2008-12-20 16:01:39 Re: simple example of copying data from a c/c++ array into postgres