Received: from localhost (maia-1.hub.org [200.46.204.191]) by postgresql.org (Postfix) with ESMTP id 095959FBC35 for ; Thu, 22 Mar 2007 10:57:52 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.191]) (amavisd-new, port 10024) with ESMTP id 04446-01 for ; Thu, 22 Mar 2007 10:57:44 -0300 (ADT) X-Greylist: delayed 00:21:15.160442 by SQLgrey-1.7.4 Received: from out5.smtp.messagingengine.com (out5.smtp.messagingengine.com [66.111.4.29]) by postgresql.org (Postfix) with ESMTP id 9A70E9FB71D for ; Thu, 22 Mar 2007 10:57:44 -0300 (ADT) Received: from compute1.internal (unknown [10.202.2.41]) by out1.messagingengine.com (Postfix) with ESMTP id EC03720C035 for ; Thu, 22 Mar 2007 09:36:25 -0400 (EDT) Received: from web4.messagingengine.com ([10.202.2.213]) by compute1.internal (MEProxy); Thu, 22 Mar 2007 09:36:29 -0400 Received: by web4.messagingengine.com (Postfix, from userid 99) id 0ADA618C1D4; Thu, 22 Mar 2007 09:36:29 -0400 (EDT) Message-Id: <1174570588.12521.1180808513@webmail.messagingengine.com> X-Sasl-Enc: ttwwd31fQA9SObvrqNrV0d+16xwtWuTbua8Q+XqaTfli 1174570588 From: "CN" To: pgsql-interfaces@postgresql.org Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="Big5" MIME-Version: 1.0 X-Mailer: MessagingEngine.com Webmail Interface Subject: Libpq: PQunescapeBytea Date: Thu, 22 Mar 2007 21:36:28 +0800 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=2.315 tagged_above=0 required=5 tests=BAYES_40, RAZOR2_CF_RANGE_51_100, RAZOR2_CF_RANGE_E8_51_100, RAZOR2_CHECK X-Spam-Level: ** X-Archive-Number: 200703/30 X-Sequence-Number: 6471 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 =A1X 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 --=20 http://www.fastmail.fm - Choose from over 50 domains or use your own