X-Original-To: pgsql-hackers-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id AE71AD1B2A4 for ; Tue, 27 Jul 2004 04:08:06 -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 43841-03 for ; Tue, 27 Jul 2004 07:07:53 +0000 (GMT) Received: from yass.opencloud.co.nz (yass.opencloud.co.nz [203.79.85.162]) by svr1.postgresql.org (Postfix) with ESMTP id 325FBD1B179 for ; Tue, 27 Jul 2004 04:07:52 -0300 (ADT) Received: from 203-79-104-60.cable.paradise.net.nz ([203.79.104.60] helo=opencloud.com) by yass.opencloud.co.nz with asmtp (Exim 3.35 #1 (Debian)) id 1BpM3x-0004nO-00; Tue, 27 Jul 2004 19:07:49 +1200 Message-ID: <4105FF43.40508@opencloud.com> Date: Tue, 27 Jul 2004 19:07:47 +1200 From: Oliver Jowett User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.6b) Gecko/20031205 Thunderbird/0.4 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Thomas Hallgren Cc: pgsql-hackers@postgresql.org Subject: Re: Binary Cursors, and the COPY command References: <10519.64.119.142.34.1090863707.squirrel@mail.mohawksoft.com> <410574F9.9020103@opencloud.com> In-Reply-To: Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.1 tagged_above=0.0 required=5.0 tests=RCVD_IN_SORBS X-Spam-Level: X-Archive-Number: 200407/1291 X-Sequence-Number: 56852 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