questionable codes in libpq/backend communication

Поиск
Список
Период
Сортировка
От t-ishii@sra.co.jp
Тема questionable codes in libpq/backend communication
Дата
Msg-id 199805110918.SAA07306@srapc451.sra.co.jp
обсуждение исходный текст
Список pgsql-hackers
Hi, There are some codes in libpq/backend communication that seem very
strange to me.

in backend/access/common/printtup.c printtup():

            pq_putint(strlen(outputstr) + VARHDRSZ, VARHDRSZ);
            pq_putnchar(outputstr, strlen(outputstr));

the first line above sends the data length and second actually sends
the data. My question is why the data length is "strlen(outputstr) +
VARHDRSZ", not just strlen(outputstr). After some investigation, I
found a code fragment that might be an answer. In
interfaces/libpq/fe-exec.c getTuple():

            /* get the value length (the first four bytes are for length) */
            pqGetInt(&vlen, 4, pfin, pfdebug);
            if (binary == 0)
            {
                vlen = vlen - 4;
            }

Woh! The misterious 4-byte has been subtracted by libpq!  Seems they
have been remained just for historical reasons.
--
Tatsuo Ishii
t-ishii@sra.co.jp

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

Предыдущее
От: Carlos Navarro Garcia
Дата:
Сообщение: Portals
Следующее
От: Andreas Zeugswetter
Дата:
Сообщение: float --> int