Re: convert binary string to datum

Поиск
Список
Период
Сортировка
От Ron Peterson
Тема Re: convert binary string to datum
Дата
Msg-id 20071013033214.GB5729@yellowbank.com
обсуждение исходный текст
Ответ на convert binary string to datum  (Ron Peterson <ron.peterson@yellowbank.com>)
Ответы Re: convert binary string to datum  (Gregory Stark <stark@enterprisedb.com>)
Список pgsql-general
2007-10-12_22:22:32-0400 Ron Peterson <ron.peterson@yellowbank.com>:
> How does one convert an octet string (e.g. something like a varlena
> structure) to a Datum?  I want to create datums for use w/
> heap_form_tuple in a function returning a tuple containing bytea
> representations of very large integers.

Is this a legitimate/blessed way to go about it?

aval = (bytea *)palloc( len + VARHDRSZ );
VARATT_SIZEP(aval) = len + VARHDRSZ;
memcpy( VARDATA(aval), myrawdata, len );

values[0] = PointerGetDatum(aval);

...etc

tuple = heap_formtuple( tupdesc, values, &isNull );

--
Ron Peterson
https://www.yellowbank.com/

В списке pgsql-general по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: can I define own variables?
Следующее
От: "brien colwell"
Дата:
Сообщение: contrib / fuzzystr documentation