1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-28 23:42:10 +03:00

Add PQunescapeBytea libpq function.

Everyone using libpq and bytea is probably having to invent this wheel..

Patrick Welche
This commit is contained in:
Bruce Momjian
2002-03-04 23:59:14 +00:00
parent b2aade0e4b
commit 294f0d4bd6
4 changed files with 137 additions and 25 deletions

View File

@ -1,5 +1,5 @@
<!--
$Header: /cvsroot/pgsql/doc/src/sgml/libpq.sgml,v 1.87 2002/01/18 20:39:04 momjian Exp $
$Header: /cvsroot/pgsql/doc/src/sgml/libpq.sgml,v 1.88 2002/03/04 23:59:11 momjian Exp $
-->
<chapter id="libpq">
@ -955,6 +955,25 @@ strings overlap.
byte is also added. The single quotes that must surround
PostgreSQL string literals are not part of the result string.
</para>
<para>
<function>PQunescapeBytea</function>
Converts an escaped string representation of binary data into binary
data - the reverse of <function>PQescapeBytea</function>.
<synopsis>
unsigned char *PQunescapeBytea(unsigned char *from, size_t *to_length);
</synopsis>
The <paramater>from</parameter> parameter points to an escaped string
such as might be returned by <function>PQgetvalue</function> of a
<type>BYTEA</type> column. <function>PQunescapeBytea</function> converts
this NUL terminated string representation into binary, filling a buffer.
It returns a pointer to the buffer which is NULL on error, and the size
of the buffer in <parameter>to_length</parameter>. The pointer may
subsequently be used as an argument to the function
<function>free(3)</function>.
</para>
</sect2>