Libpq: PQunescapeBytea

Поиск
Список
Период
Сортировка
От CN
Тема Libpq: PQunescapeBytea
Дата
Msg-id 1174570588.12521.1180808513@webmail.messagingengine.com
обсуждение исходный текст
Ответы Re: Libpq: PQunescapeBytea  ("Daniel Verite" <daniel@manitou-mail.org>)
Re: Libpq: PQunescapeBytea  ("Daniel Verite" <daniel@manitou-mail.org>)
Список pgsql-interfaces
Hi!

I write binary strings to bytea column by calling PQexecParams and
passing "1" indicating a binary data to parameter paramFormats. This
function is handy of course because there is no need to escape the
to-write binary strings before calling PQexecParams.

Now I notice that in order to restore the string to its original form
(the binary string without escaped), I will call PQgetvalue and pass its
returned value to PQunescapeBytea.

What I don't understand are these two parts of manual (Chapter 29. libpq
- C Library):

[quote]
PQunescapeBytea

Converts a string representation of binary data into binary data — the
reverse of PQescapeBytea. This is needed when retrieving bytea data in
text format, but not when retrieving it in binary format.
[end quote]

Question: Does it mean that there exist some functions being able to
retrieve bytea columns in "binary format"? My understanding of its
meaning is that these functions will automatically restore the data read
from database to their original unescaped binary strings and thus
PQescapeBytea needs not to be called. If it does, what are these
functions? PQgetvalue appears to be not one of them I think.

[quote]
This conversion is not exactly the inverse of PQescapeBytea, because the
string is not expected to be "escaped" when received from PQgetvalue.
[end quote]

Question: Would someone kindly help me understand the above sentence?

TIA
CN

--
http://www.fastmail.fm - Choose from over 50 domains or use your own



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

Предыдущее
От: Devrim GÜNDÜZ
Дата:
Сообщение: Re: Postgres 8.1.4
Следующее
От: "Daniel Verite"
Дата:
Сообщение: Re: Libpq: PQunescapeBytea