Datum problem

Поиск
Список
Период
Сортировка
От Enrico
Тема Datum problem
Дата
Msg-id 20061109181208.15722467@mypc.ricordatasystem.info
обсуждение исходный текст
Ответы Re: Datum problem  (Martijn van Oosterhout <kleptog@svana.org>)
Re: Datum problem  ("A. Kretschmer" <andreas.kretschmer@schollglas.com>)
Re: Datum problem  (Enrico <scotty@linuxtime.it>)
Список 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 по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: authentication question
Следующее
От: "Nathan Leon Pace, MD, MStat"
Дата:
Сообщение: Mac OS X