Received: from localhost (unknown [200.46.204.183]) by mail.postgresql.org (Postfix) with ESMTP id 68A1864FC7D for ; Sat, 20 Dec 2008 13:18:34 -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 23759-07 for ; Sat, 20 Dec 2008 13:18:31 -0400 (AST) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from rn-out-0910.google.com (rn-out-0910.google.com [64.233.170.185]) by mail.postgresql.org (Postfix) with ESMTP id B0EB464FC56 for ; Sat, 20 Dec 2008 13:18:31 -0400 (AST) Received: by rn-out-0910.google.com with SMTP id k40so1118922rnd.0 for ; Sat, 20 Dec 2008 09:18:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to :subject:cc:in-reply-to:mime-version:content-type :content-transfer-encoding:content-disposition:references; bh=5hlDr0AfHd9oe8Ks8uuPjEk7F64sHk8CGWPjC95eX88=; b=IcpRwFlWp0Qv9ms4VyPDoBbq58oDTm8ip9O0NuwmGLdjhgQz7OqLQNbo5PAcXcPPel TixVVve7BtvLvqdxFLfqOxn2kEoTsOBW9GkOWcHiAuuMVI+KQ3Ph239N6RQIPbQCk0MC wz+NRAwihJoxZJcQv5Oq/0eSRPQEczGWjc2VQ= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:cc:in-reply-to:mime-version :content-type:content-transfer-encoding:content-disposition :references; b=X7V8O8JEUd9hYJEULRIHc6oVqpeMPl8XB7kZmrZUxSIGhuaEsVmVdVcvnLs1ZXtNtY tR/H9LKQKl5pTqHpzO99d6zxdOyUxkI01B5ihUUTNyM9zZjyX70y8iqDxNKp2vkZnNCc +xMMRFm3s+wm6djNor9YB2S8XETpcb4ZDmI3A= Received: by 10.150.139.15 with SMTP id m15mr8090170ybd.75.1229793510281; Sat, 20 Dec 2008 09:18:30 -0800 (PST) Received: by 10.151.125.1 with HTTP; Sat, 20 Dec 2008 09:18:30 -0800 (PST) Message-ID: <8ec76080812200918y5144c754sd2d73ad0759c117@mail.gmail.com> Date: Sat, 20 Dec 2008 12:18:30 -0500 From: "Whit Armstrong" To: "Jeroen Vermeulen" Subject: Re: simple example of copying data from a c/c++ array into postgres Cc: pgsql-interfaces@postgresql.org In-Reply-To: <494D16E3.4030806@xs4all.nl> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <8ec76080812090708g93000f9l7e7f3e2162587331@mail.gmail.com> <493EA271.8010209@xs4all.nl> <8ec76080812090936g596abf91jdd8a184c3f56c32@mail.gmail.com> <49413DE7.8040703@xs4all.nl> <8ec76080812110837y44785948gc9f367740c91071d@mail.gmail.com> <494D16E3.4030806@xs4all.nl> 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/19 X-Sequence-Number: 6836 Thanks for you reply. I'll definitely stick to convention. Cheers, Whit On Sat, Dec 20, 2008 at 11:01 AM, Jeroen Vermeulen 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 >