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

Re: Binary tx format for an array?

From: Mark Lewis <mark(dot)lewis(at)mir3(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Michael Guyver <kenevel(at)googlemail(dot)com>, pgsql-jdbc(at)postgresql(dot)org
Subject: Re: Binary tx format for an array?
Date: 2006-06-22 19:16:13
Message-ID: 1151003773.21238.13.camel@archimedes (view raw or flat)
Thread:
Lists: pgsql-jdbc
> appropriate thing in Java --- I was under the impression that Java tried
> to hide hardware details like endianness, so there may be some
> convention about how you turn a sequence of bytes into a native integer.

Java tried so hard to hide endianness from you that it didn't provide
any real support for those times when you DO need to be aware of it.  So
the "convention" looks kind of like this (snipped from the PG JDBC
driver):

    public void SendInteger4(int val) throws IOException
    {
        SendChar((val >> 24)&255);
        SendChar((val >> 16)&255);
        SendChar((val >> 8)&255);
        SendChar(val&255);
    }

There finally were endian-aware buffer operations added in JDK 1.4, but
using them would be a big code change and would make the driver
unavailable for users of antique JVM's.

-- Mark

In response to

Responses

pgsql-jdbc by date

Next:From: Sebastiaan van ErkDate: 2006-06-22 20:14:12
Subject: Re: Limit vs setMaxRows issue
Previous:From: Tom LaneDate: 2006-06-22 16:55:09
Subject: Re: Binary tx format for an array?

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