Re: PQunescapeBytea Question

Lists: pgsql-general
From: Jerry LeVan <jerry(dot)levan(at)eku(dot)edu>
To: Postgres General <pgsql-general(at)postgresql(dot)org>
Subject: PQunescapeBytea Question
Date: 2004-08-05 14:49:10
Message-ID: 9BFA4BA8-E6EE-11D8-8CDC-000393779D9C@eku.edu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general

Is there any chance that PQunescapeBytea will
always have a \000 at the end of the
unescaped buffer?

unescvalue = PQgetvalue(lastResult, row, fieldNum);
value = PQunescapeBytea(unescvalue, &size);

ie is "value" a C string or do I have to make
another copy so I can append a \000 byte?

Sigh, I expect the latter...

Jerry


From: Kris Jurka <books(at)ejurka(dot)com>
To: Jerry LeVan <jerry(dot)levan(at)eku(dot)edu>
Cc: Postgres General <pgsql-general(at)postgresql(dot)org>
Subject: Re: PQunescapeBytea Question
Date: 2004-08-05 20:11:44
Message-ID: Pine.BSO.4.56.0408051510520.23098@leary.csoft.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general

On Thu, 5 Aug 2004, Jerry LeVan wrote:

> Is there any chance that PQunescapeBytea will
> always have a \000 at the end of the
> unescaped buffer?

What would the point of that be? It's binary data and may have embedded
nulls so you'll need to always keep track of length separately.

Kris Jurka