Re: libpq: PQexecParams, binaryFormat and float

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: libpq: PQexecParams, binaryFormat and float
Дата
Msg-id 8175.1183148838@sss.pgh.pa.us
обсуждение исходный текст
Ответ на libpq: PQexecParams, binaryFormat and float  ("Sun, Way" <Way.Sun@sciatl.com>)
Список pgsql-interfaces
"Sun, Way" <Way.Sun@sciatl.com> writes:
>     float    loadavg;
>     loadavg = htonl(1.23);

It seems entirely unlikely that that will produce a byte-reversed float
value; what I think will happen is that the byte-reversed value of
integer 1 will be converted into a host-format float and stored into
loadavg.

AFAIK you can't really do this in C without a union.  Take a look at 
pq_sendfloat4 and pq_getmsgfloat4 in the backend for examples.
        regards, tom lane


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

Предыдущее
От: "Sun, Way"
Дата:
Сообщение: libpq: PQexecParams, binaryFormat and float
Следующее
От: "anoopmadavoor@gmail.com"
Дата:
Сообщение: How I can return a set of recordset from PL/Python