pg.ddx.io  pgsql-interfaces@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: CN <cnliou9@fastmail.fm>
To: pgsql-interfaces@postgresql.org
Subject: Libpq: PQunescapeBytea
Date: Thu, 22 Mar 2007 21:36:28 +0800
Message-ID: <1174570588.12521.1180808513@webmail.messagingengine.com> (raw)

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 ¡X 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




view thread (2+ messages)  latest in thread

Message-ID: <1174570588.12521.1180808513@webmail.messagingengine.com>
Permalink:  ../1174570588.12521.1180808513@webmail.messagingengine.com/
Also on:    postgresql.org/message-id/1174570588.12521.1180808513@webmail.messagingengine.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-interfaces@postgresql.org
  Cc: cnliou9@fastmail.fm
  Subject: Re: Libpq: PQunescapeBytea
  In-Reply-To: <1174570588.12521.1180808513@webmail.messagingengine.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox