Обсуждение: Binary data in bytea field

Поиск
Список
Период
Сортировка

Binary data in bytea field

От
Iklódi Lajos
Дата:
I have a table with field of tyte bytea. I'm reading this table with C,
libpq.
The result is a string, with octal groups, like '\200'.
Is it possible to get data as it is, every byte in one byte?
Thanks




Re: Binary data in bytea field

От
Joe Conway
Дата:
Iklódi Lajos wrote:
> I have a table with field of tyte bytea. I'm reading this table with C,
> libpq.
> The result is a string, with octal groups, like '\200'.
> Is it possible to get data as it is, every byte in one byte?
> Thanks
> 

Sure -- just use a binary cursor.

HTH,

Joe





Re: Binary data in bytea field

От
Iklódi Lajos
Дата:
> Iklódi Lajos wrote:
> > I have a table with field of tyte bytea. I'm reading this table with C,
> > libpq.
> > The result is a string, with octal groups, like '\200'.
> > Is it possible to get data as it is, every byte in one byte?
> > Thanks
> >
>
> Sure -- just use a binary cursor.
>
> HTH,
>
> Joe

Thanks, really it is in docs.
How can I make binary updates?

Lajos




Re: Binary data in bytea field

От
Joe Conway
Дата:
Iklódi Lajos wrote:
>>Iklódi Lajos wrote:
>>
>>>I have a table with field of tyte bytea. I'm reading this table with C,
>>>libpq.
>>>The result is a string, with octal groups, like '\200'.
>>>Is it possible to get data as it is, every byte in one byte?
>>>Thanks
>>>
>>
>>Sure -- just use a binary cursor.
>>
>>HTH,
>>
>>Joe
> 
> 
> Thanks, really it is in docs.
> How can I make binary updates?
> 
> Lajos
> 

See:
http://www.us.postgresql.org/users-lounge/docs/7.2/postgres/libpq-exec.html
section 1.3.3 "Escaping binary strings for inclusion in SQL queries".

Joe