Re: "money" binary representation

Поиск
Список
Период
Сортировка
Искать
От
Jasen Betts
Тема
Re: "money" binary representation
Дата
Msg-id
hdr0uh$6um$2@reversiblemaps.ath.cx
Список
Дерево обсуждения
Re: "money" binary representation Jasen Betts <jasen@xnet.co.nz>
Re: "money" binary representation Merlin Moncure <mmoncure@gmail.com>
Re: "money" binary representation Andrew Chernow <ac@esilo.com>
On 2009-11-16, Konstantin Izmailov  wrote:
> --000e0cd5d09230ff7d04787526aa
> Content-Type: text/plain; charset=ISO-8859-1
>
> I'm trying to read "money" field using PQgetvalue (PostgreSQL 8.3.7). The
> function returns 9 bytes, smth like 0h 0h 0h 0h 0h 0h 14h 0h 0h, for the
> value '$50.2'. I could not find description anywhere on how to convert the
> binary data into, for example, a double precision number.

money is a 64 bit integer representing a number of cents, it appears
to be big-endian byte order on ypur system

it is deprecated and should not be used in new applications, use some
sort of numeric instead.

> Would you please help me find a method of converting binary "money" data
> into a double precision?

floating point is not recomended for financial calculations, but
dividing the integer value by 100.0 should get you there.

В списке pgsql-general по дате отправления
От: Konstantin Izmailov
Дата:
От: Jasen Betts
Дата:
Сообщение: Re: -c argument not recognized
FAQ