Skip site navigation (1) Skip section navigation (2)

Re: libpq 7.4 and binary cursor

From: L J Bayuk <ljb220(at)mindspring(dot)com>
To: stephane(dot)raimbault(at)free(dot)fr (Stephane Raimbault)
Cc: pgsql-interfaces(at)postgresql(dot)org
Subject: Re: libpq 7.4 and binary cursor
Date: 2004-06-10 23:44:54
Message-ID: 200406102344.i5ANis8w000268@mindspring.com (view raw or flat)
Thread:
Lists: pgsql-interfaces
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.

In response to

pgsql-interfaces by date

Next:From: Eliot SimcoeDate: 2004-06-14 18:25:45
Subject: libpq binary transfer of the numeric data type
Previous:From: Terry Lee TuckerDate: 2004-06-10 18:09:13
Subject: Locking Question

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group