Re: Libpq: PQunescapeBytea - Mailing list pgsql-interfaces

From Daniel Verite
Subject Re: Libpq: PQunescapeBytea
Date
Msg-id 20070322172202.17336
Whole thread Raw
In response to Libpq: PQunescapeBytea  ("CN" <cnliou9@fastmail.fm>)
List pgsql-interfaces
    CN wrote:

> 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.

There's no specific function but when you pass 1 to the
'resultFormat' parameter of PQexecParams(), its results are
returned in binary format.
Then PQgetvalue() will give you the address of the data and
PQgetlength() its size. When this data is of type bytea, no
conversion is required.

-- DanielPostgreSQL-powered mail user agent and storage: http://www.manitou-mail.org


pgsql-interfaces by date:

Previous
From: "Daniel Verite"
Date:
Subject: Re: Libpq: PQunescapeBytea
Next
From: "CN"
Date:
Subject: Re: Libpq: PQunescapeBytea