PQgetlength vs. octet_length()

Поиск
Список
Период
Сортировка
От Michael Clark
Тема PQgetlength vs. octet_length()
Дата
Msg-id bf5d83510908181039i365a0a5ag88db6eba829de5d0@mail.gmail.com
обсуждение исходный текст
Ответы Re: PQgetlength vs. octet_length()
Re: PQgetlength vs. octet_length()
Список pgsql-general
This thread was originally posted (incorrectly by me) to the hackers mailing list.  Moving the discussion to the gerenal.


Hi Greg,

That is what Pierre pointed out, and you are both right.  I am using the text mode.

But it seems pretty crazy that a 140meg bit of data goes to 1.3 gigs.  Does that seem a bit excessive?

I avoided the binary mode because that seemed to be rather confusing when having to deal with non-bytea data types.  The docs make it sound like binary mode should be avoided because what you get back for a datetime varies per platform.

Thanks,
Michael.

On Tue, Aug 18, 2009 at 12:15 PM, Greg Stark <gsstark@mit.edu> wrote:
On Tue, Aug 18, 2009 at 4:04 PM, Michael Clark<codingninja@gmail.com> wrote:
> Hello - am I in the wrong mailing list for this sort of problem? :-

Probably but it's also a pretty technical point and you're programming
in C so it's kind of borderline.

If you're using text-mode then your datum that you're getting from
libpq is a text representation of the datum. For bytea in released
versions that means anything which isn't a printable ascii character
will be octal encoded like \123. You can use PQunescapeBytea to
unescape it.

If you use binary encoding then you don't have to deal with that.
Though I seem to recall there is still a gotcha you have to worry
about if there are nul bytes in your datum. I don't recall exactly
what that meant you had to do though.

--
greg
http://mit.edu/~gsstark/resume.pdf


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

Предыдущее
От: merlyn@stonehenge.com (Randal L. Schwartz)
Дата:
Сообщение: Re: Postgre RAISE NOTICE and PHP
Следующее
От: Greg Stark
Дата:
Сообщение: Re: PQgetlength vs. octet_length()