Re: Binary tx format for an array?

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Binary tx format for an array?
Дата
Msg-id 1048.1150995309@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Binary tx format for an array?  ("Michael Guyver" <kenevel@googlemail.com>)
Ответы Re: Binary tx format for an array?  (Mark Lewis <mark.lewis@mir3.com>)
Список pgsql-jdbc
"Michael Guyver" <kenevel@googlemail.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

В списке pgsql-jdbc по дате отправления:

Предыдущее
От: David Wall
Дата:
Сообщение: Re: Limit vs setMaxRows issue
Следующее
От: Mark Lewis
Дата:
Сообщение: Re: Binary tx format for an array?