pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Oliver Jowett <oliver@opencloud.com>
To: Thomas Hallgren <thhal@mailblocks.com>
Cc: pgsql-hackers@postgresql.org
Subject: Re: Binary Cursors, and the COPY command
Date: Tue, 27 Jul 2004 19:07:47 +1200
Message-ID: <4105FF43.40508@opencloud.com> (raw)
In-Reply-To: <ce4t7l$pas$2@sea.gmane.org>
References: <10519.64.119.142.34.1090863707.squirrel@mail.mohawksoft.com>
	<410574F9.9020103@opencloud.com>
	<ce4t7l$pas$2@sea.gmane.org>

Thomas Hallgren wrote:
> Oliver Jowett wrote:
>  > This is not true if you happen to be using Java on the client side,
>  > which has no idea (unless you grot around in the guts of the JVM) what
>  > the native byte order is.
>  >
> The method java.nio.ByteOrder.nativeOrder() will tell you what the 
> native byte order is.

NIO is not present before JDK 1.4. The JDBC driver, at least, needs to 
support earlier JVMs.

>  > This actually means that Java clients have the
>  > opposite problem -- it's a lot of work to try to use the 7.3-style
>  > binary formats.
>  >
> The commonly used java.io.DataInput will always use network order but 
> it's easy enough to read/write little endian using the java.nio and 
> java.nio.channel packages.

That's no use if you don't know the endianness of the data you're 
receiving (which is what happens under <= 7.3 -- the data followed the 
server's byte ordering)

The problem with using native byte orderings is not the byte ordering 
itself, but that the order is unpredictable -- at best, you have to 
implement code to handle both orders, and at worst you have to just take 
a guess and hope you were right..

-O



view thread (15+ messages)  latest in thread

Message-ID: <4105FF43.40508@opencloud.com>
Permalink:  ../4105FF43.40508@opencloud.com/
Also on:    postgresql.org/message-id/4105FF43.40508@opencloud.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-jdbc@postgresql.org
  Cc: oliver@opencloud.com, thhal@mailblocks.com, pgsql-hackers@postgresql.org
  Subject: Re: Binary Cursors, and the COPY command
  In-Reply-To: <4105FF43.40508@opencloud.com>
  References: <10519.64.119.142.34.1090863707.squirrel@mail.mohawksoft.com> <410574F9.9020103@opencloud.com> <ce4t7l$pas$2@sea.gmane.org> <4105FF43.40508@opencloud.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox