Skip site navigation (1) Skip section navigation (2)

Re: Reading bytea field

From: Volkan YAZICI <volkan(dot)yazici(at)gmail(dot)com>
To: Jochen Kokemüller <jochen(at)kokemueller(dot)de>
Cc: pgsql-interfaces(at)postgresql(dot)org
Subject: Re: Reading bytea field
Date: 2005-10-21 23:30:02
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-interfacespgsql-sql

On 10/21/05, Jochen Kokemüller <jochen(at)kokemueller(dot)de> wrote:
> I read that it is better to use PQexecParams instead of PQescape. In the
> bytea field is then the picture with every Byte escaped. So the first
> few bytes look like this:
>  \377\330\377\340\000\020JFIF ...
> I wouldn't bother if i knew how to unescape this sequence. I supposed
> that this is more or less an internal representation, but when i try to
> retrieve the data. i get it like this.

If you'd use PQexecParams() for SELECT query with resultType = 1, you
shouldn't have any problem. Take a look at the examples in the

Attachment: recv.c
Description: text/x-csrc (958 bytes)
Attachment: send.c
Description: text/x-csrc (1.3 KB)

In response to

pgsql-interfaces by date

Next:From: Louis CastoriaDate: 2005-10-25 17:04:33
Subject: libpq status question
Previous:From: Stefan T. PetersDate: 2005-10-21 20:28:11
Subject: Re: libpq won't connect when client is built with MinGW

pgsql-sql by date

Next:From: Tom LaneDate: 2005-10-22 03:23:48
Subject: Re: Blank-padding (was: Oracle buys Innobase)
Previous:From: Dean Gibson (DB Administrator)Date: 2005-10-21 23:28:48
Subject: Blank-padding (was: Oracle buys Innobase)

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group