X-Original-To: pgsql-interfaces-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id CA629D1B1CE for ; Thu, 10 Jun 2004 22:23:45 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 39363-06 for ; Fri, 11 Jun 2004 01:23:44 +0000 (GMT) Received: from hall.mail.mindspring.net (hall.mail.mindspring.net [207.69.200.60]) by svr1.postgresql.org (Postfix) with ESMTP id E63A6D1B1CB for ; Thu, 10 Jun 2004 22:23:39 -0300 (ADT) Received: from sdn-ap-008njpennp0166.dialsprint.net ([63.185.200.166] helo=mindspring.com) by hall.mail.mindspring.net with esmtp (Exim 3.33 #1) id 1BYali-0001Pw-00; Thu, 10 Jun 2004 21:23:43 -0400 Received: (from lbayuk@localhost) by mindspring.com (8.12.10/8.12.10) id i5ANis8w000268; Thu, 10 Jun 2004 19:44:54 -0400 From: L J Bayuk Message-Id: <200406102344.i5ANis8w000268@mindspring.com> Subject: Re: libpq 7.4 and binary cursor To: stephane.raimbault@free.fr (Stephane Raimbault) Date: Thu, 10 Jun 2004 19:44:54 -0400 (EDT) Cc: pgsql-interfaces@postgresql.org In-Reply-To: <1086877827.4646.22.camel@picasso.lan> from "Stephane Raimbault" at Jun 10, 2004 04:30:27 PM X-Mailer: ELM [version 2.5 PL6] MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=1.1 tagged_above=0.0 required=5.0 tests=FROM_ENDS_IN_NUMS, RCVD_IN_NJABL, RCVD_IN_SORBS X-Spam-Level: * X-Archive-Number: 200406/32 X-Sequence-Number: 4960 Stephane Raimbault wrote: > > It seems some changes occured in network protocol between 7.3 and 7.4. Big understatement! It was completely redesigned. > In my simple libray above libpq, I used this call to extract float8 with > a binary cursor (on x86) : > ... Pre-7.4, binary data came back in the server's byte order. Starting 7.4, data always comes back in "network data order", which is big-endian, regardless of server or client architecture. This is a big improvement, so you can now portably deal with binary data. The proper way to do so in the client is to use the ntohs() and ntohl() functions to turn network data order into native order.