Received: from localhost (unknown [200.46.204.183]) by mail.postgresql.org (Postfix) with ESMTP id CABC464FD19 for ; Sat, 20 Dec 2008 12:02:05 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 12991-07 for ; Sat, 20 Dec 2008 12:02:03 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from smtp-vbr11.xs4all.nl (smtp-vbr11.xs4all.nl [194.109.24.31]) by mail.postgresql.org (Postfix) with ESMTP id 15A7C64FC56 for ; Sat, 20 Dec 2008 12:02:02 -0400 (AST) Received: from [10.0.0.142] (125.25.92.26.adsl.dynamic.totbb.net [125.25.92.26]) (authenticated bits=0) by smtp-vbr11.xs4all.nl (8.13.8/8.13.8) with ESMTP id mBKG1kaf089179 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sat, 20 Dec 2008 17:01:53 +0100 (CET) (envelope-from jtv@xs4all.nl) Message-ID: <494D16E3.4030806@xs4all.nl> Date: Sat, 20 Dec 2008 23:01:39 +0700 From: Jeroen Vermeulen User-Agent: Thunderbird 2.0.0.18 (X11/20081125) MIME-Version: 1.0 To: Whit Armstrong CC: pgsql-interfaces@postgresql.org Subject: Re: simple example of copying data from a c/c++ array into postgres References: <8ec76080812090708g93000f9l7e7f3e2162587331@mail.gmail.com> <493EA271.8010209@xs4all.nl> <8ec76080812090936g596abf91jdd8a184c3f56c32@mail.gmail.com> <49413DE7.8040703@xs4all.nl> <8ec76080812110837y44785948gc9f367740c91071d@mail.gmail.com> In-Reply-To: <8ec76080812110837y44785948gc9f367740c91071d@mail.gmail.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by XS4ALL Virus Scanner X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests=none X-Spam-Level: X-Archive-Number: 200812/18 X-Sequence-Number: 6835 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