C function woes

Поиск
Список
Период
Сортировка
От Chris Hayner
Тема C function woes
Дата
Msg-id Pine.OSF.4.32.0102201627210.31416-100000@typhoon.ocis.temple.edu
обсуждение исходный текст
Ответ на Re: Printing PostgreSQL reports  ("Gregory Wood" <gregw@com-stock.com>)
Ответы Re: C function woes  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-general
hello all:

I am attempting to create a function which will return data from a
C-function. This is what i have, and it so far has been successful. Any
help anyone can give me would be greatly appreciated.

gcc Compiler, PgSQL 7.1 beta 3
thanks,
chris


-----------------------------------------------------------------------
#include <string.h>
#include "/usr/local/pgsql/include/postgres.h"

text *
hello()
 {
        char data[] = "hello world";
        int32 new_text_size = VARHDRSZ + sizeof(data);
        text *new_text = (text *) palloc(new_text_size);

        strcpy(VARDATA(new_text), data);
        return new_text;
 }




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

Предыдущее
От: "Mitch Vincent"
Дата:
Сообщение: Re: Re: Printing PostgreSQL reports
Следующее
От: Chris Hayner
Дата:
Сообщение: C function woes (more info)