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

Re: Binary tx format for an array?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Michael Guyver" <kenevel(at)googlemail(dot)com>
Cc: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: Binary tx format for an array?
Date: 2006-06-22 16:55:09
Message-ID: 1048.1150995309@sss.pgh.pa.us (view raw or flat)
Thread:
Lists: pgsql-jdbc
"Michael Guyver" <kenevel(at)googlemail(dot)com> writes:
> are the bytes representing an int4 Oid simply 23, represented in variable buf as

> [0x17][0x00][0x00][0x00]

No, in the buffer they'll be in network (big-endian) byte order,

[0x00][0x00][0x00][0x17]

If you are running in a little-endian architecture (eg Intel) then at
some point you'll be wanting to reverse the byte order to make a native
integer.  In C you'd use ntohl() to do this.  I'm not sure what's the
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.

			regards, tom lane

In response to

Responses

pgsql-jdbc by date

Next:From: Mark LewisDate: 2006-06-22 19:16:13
Subject: Re: Binary tx format for an array?
Previous:From: David WallDate: 2006-06-22 16:36:33
Subject: Re: Limit vs setMaxRows issue

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