postgres.h MACRO issues

Поиск
Список
Период
Сортировка
От David Busby
Тема postgres.h MACRO issues
Дата
Msg-id 3D2E0144.4070902@pnts.com
обсуждение исходный текст
Ответы Re: postgres.h MACRO issues  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-bugs
Elephant Developers,

    I've got a bit of an issue with using your macros while building my own C
function for PostgreSQL (btw: C functions are a wayyyy cool feature).
So I'm returning a char(32) from my function and I'm using the text*
structure to work with my data.  Here's where I've got trouble.

// Put my 32 bytes into the buffer, this works perfect
memcpy(VARDATA(out_text), pbuf, 32);
// Tell it the buffer size
// I don't like that I've got to add the header size myself
// could/should VARATT_SIZEP handle that for me?
VARATT_SIZEP(out_text) = VARHDRSZ + 32;

// This doesn't work right, but I assumed that it would
// I thought that VARATT_SIZEP would automagically take into
// account the VARHDSZ so I only say "my data size is X"
// not have to say "my data size is X + your header"
// Seems a little odd to me.
VARATT_SIZEP(out_text) = 32

So...I just wanted to share that with you folks, should also mention
that I really apperciate (sp?) the work you've done so far and look
forward to future versions.

Thanks for the cycles
/B

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

Предыдущее
От: Andrew Sullivan
Дата:
Сообщение: Re: 7.2.1 backend crash (convert_string_datum, locale)
Следующее
От: "praveen vejandla"
Дата:
Сообщение: problem with query in postgres 6.5