Datum problem
От | Enrico |
---|---|
Тема | Datum problem |
Дата | |
Msg-id | 20061109181208.15722467@mypc.ricordatasystem.info обсуждение исходный текст |
Ответы |
Re: Datum problem
Re: Datum problem Re: Datum problem |
Список | pgsql-general |
Hi, I'm newbie of programming postgresql sever side, I write the function below and when I execute SELECT (anag_art, 150) AS esistenza from anag_art order by 1; result is something about this: | esistenza | ("(""0000002 "",""ARTICOLO PREZ. VEND. "",,PZ,32,1,20,""1 "","" "","""",N,,0,-67.00000,-23.00000,,N,N)",150) So postgresql outputs with a tuple, instead of an integer value as I wish. Can anyone helps me? Thanks in advantage. Enrico ------------------- Start C code --------------- #include "postgres.h" #include "executor/executor.h" PG_FUNCTION_INFO_V1(visualizza_esistenza); Datum visualizza_esistenza(PG_FUNCTION_ARGS) { HeapTupleHeader t = PG_GETARG_HEAPTUPLEHEADER(0); int16 limit = PG_GETARG_INT16(1); bool isnull; Datum esistenza; int16 es; esistenza = GetAttributeByName(t, "esistenza", &isnull); es = DatumGetInt16(esistenza); if (esistenza > limit) PG_RETURN_INT16(es); } ------------------- End C code --------------- CREATE OR REPLACE FUNCTION visualizza_esistenza(anag_art, integer) RETURNS int4 as '/home/scotty/enrico/postgresql_c/prova.so', 'visualizza_esistenza' LANGUAGE C; -- If Bill Gates had a penny for everytime Windows crashed,he'd be a multi-billionaire by now .......oh look, he already is!!!! scotty@linuxtime.it - Skype:sscotty71 http://www.linuxtime.it/enricopirozzi
В списке pgsql-general по дате отправления: