Re: Now for the VARDATA, VARSIZE, and VARHDRSZ stuff

Поиск
Список
Период
Сортировка
От Peter Eisentraut
Тема Re: Now for the VARDATA, VARSIZE, and VARHDRSZ stuff
Дата
Msg-id Pine.LNX.4.30.0104161558510.760-100000@peter.localdomain
обсуждение исходный текст
Ответ на Now for the VARDATA, VARSIZE, and VARHDRSZ stuff  (Lonnie Cumberland <lonnie_cumberland@yahoo.com>)
Список pgsql-interfaces
Lonnie Cumberland writes:

> I now have a simple question about the use of these VARDATA() VARSIZE() and
> VARHDRSZ() wrappers

VARDATA is a pointer (to char?) to where the actual data of the specific
value starts.  VARSIZE is the length of the specific value, plus the
header.  VARHRDZ is the size of the header, currently always 4.  For
example, if you have a text string 'abc' then the memory representation is

int    4    <-- text* points here
char    'a'    <-- VARDATA points here
char    'b'
char    'c'

VARHDRZ == 4, VARSIZE = 7

Note that the data is not null-terminated.

The best things might be not to mess with this but call textin() and
textout() to convert your data to C strings.

-- 
Peter Eisentraut   peter_e@gmx.net   http://funkturm.homeip.net/~peter



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

Предыдущее
От: Lonnie Cumberland
Дата:
Сообщение: making data types
Следующее
От: "Avinash K.G"
Дата:
Сообщение: