| От | Mike Mascari |
|---|---|
| Тема | C-language example of using/returning numeric |
| Дата | |
| Msg-id | 3D85C4CD.6090006@mascari.com обсуждение исходный текст |
| Ответы |
Re: C-language example of using/returning numeric
|
| Список | pgsql-general |
Does anyone happen to have a server-side C-language example of
using the Version-1 calling conventions with the NUMERIC data
type? Is it possible? For example, instead of writing:
PG_FUNCTION_INFO_V1(add_one);
Datum add_one(PG_FUNCTION_ARGS)
{
int32 arg = PG_GETARG_INT32(0);
PG_RETURN_INT32(arg + 1);
}
I'd like to do the equivalent with NUMERIC. I see the
appropriate macros declared in utils/numeric.h. But I'm not sure
I understand the representation of NumericData:
varlen <- self-explanatory
n_weight <- ??
n_rscale <- scale of numeric
n_sign_dscale <- ??
n_data[1] <- ?? is this BCD?
Are there any helper functions available to the C-language
server-side developer wrt numeric?
Thanks for any tips,
Mike Mascari
mascarm@mascari.com
В списке pgsql-general по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера