C function woes

From: Chris Hayner <hayner80(at)astro(dot)ocis(dot)temple(dot)edu>
To: PostgreSQL-General <pgsql-general(at)postgresql(dot)org>
Subject: C function woes
Date: 2001-02-20 21:29:41
Message-ID: Pine.OSF.4.32.0102201627210.31416-100000@typhoon.ocis.temple.edu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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;
}

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Mitch Vincent 2001-02-20 21:31:59 Re: Re: Printing PostgreSQL reports
Previous Message Tom Lane 2001-02-20 21:15:25 Re: Re: Printing PostgreSQL reports