From: | t-ishii(at)sra(dot)co(dot)jp |
---|---|
To: | pgsql-hackers(at)postgresql(dot)org |
Cc: | t-ishii(at)sra(dot)co(dot)jp |
Subject: | questionable codes in libpq/backend communication |
Date: | 1998-05-11 09:18:38 |
Message-ID: | 199805110918.SAA07306@srapc451.sra.co.jp |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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(at)sra(dot)co(dot)jp
From | Date | Subject | |
---|---|---|---|
Next Message | Michael Meskes | 1998-05-11 09:54:38 | Re: [HACKERS] connection names |
Previous Message | Andreas Zeugswetter | 1998-05-11 08:16:20 | float --> int |