From: | "Martin Gainty" <mgainty(at)hotmail(dot)com> |
---|---|
To: | "Emiliano Moscato" <moski666(at)gmail(dot)com>, "Andrej Ricnik-Bay" <andrej(dot)groups(at)gmail(dot)com> |
Cc: | <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: Stored procedures in C |
Date: | 2008-04-24 13:27:02 |
Message-ID: | BLU142-DAV97C4B8DFFCBE6F0165BABAEE20@phx.gbl |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Good Morning Emiliano-
since postgres is written in 'C'
and Most of us on this list have programmed in C ..although my experience was 'used in last millenia'
if we reference contrib/query/tsearch2/query.c
when you see statements such as
PG_FUNCTION_INFO_V1(tsquery_in);
you are calling a header file at \include\server\fmgr\fmgr.h which is macro-subbing at
specifically:
#define PG_FUNCTION_INFO_V1(funcname) \
extern Pg_finfo_record * CppConcat(pg_finfo_,funcname) (void); \
Pg_finfo_record * \
CppConcat(pg_finfo_,funcname) (void) \
{ \
static Pg_finfo_record my_finfo = { 1 }; \
return &my_finfo; \
} \
extern int no_such_variable
In any case please feel free to ping us for any questions you might have
It sounds like you have quite a challenge ahead of you
Buena Suerte
Martin-
----- Original Message -----
From: Emiliano Moscato
To: Andrej Ricnik-Bay
Cc: pgsql-general(at)postgresql(dot)org
Sent: Thursday, April 24, 2008 8:44 AM
Subject: Re: [GENERAL] Stored procedures in C
Thanks a lot for the response Andrej!
One of these texts was known for me. But all of them are VERY basic. No one explains how to do a query and manage results :(
The only one that manage querys is the source code placed at contrib/tablefunc in the Postgres distribution. But is VERY hard to follow for me :( I would like to find an intermediate step.
Thanks again
Emiliano
2008/4/23 Andrej Ricnik-Bay <andrej(dot)groups(at)gmail(dot)com>:
On 24/04/2008, Emiliano Moscato <moski666(at)gmail(dot)com> wrote:
> I have to do some stuff writing stored procedures for Postgres in C. I saw
> the oficial documentation but it was hard for me to find out how to do a
> simple function, let's call it "query()" , that receives a string and uses
> this string to do a query and return the results. Has anyone some examples?
You don't mentioned where else you looked - did you come across these?
http://linuxgazette.net/139/peterson.html
http://www.faqs.org/docs/ppbook/x15284.htm
http://www.observercentral.net/~selkovjr/postgres/tutorial/html/exttut-getstart.html
> Thanks in advance...
> Regards,
>
> Emiliano
Cheers,
Andrej
--
Please don't top post, and don't use HTML e-Mail :} Make your quotes concise.
http://www.american.edu/econ/notes/htmlmail.htm
--
mOsKi
"No hay nada que uno haga mal , lo que hay es poco vino." Autor Anonimo
From | Date | Subject | |
---|---|---|---|
Next Message | Christopher Condit | 2008-04-24 13:51:30 | Re: initdb in 8.3 |
Previous Message | Emiliano Moscato | 2008-04-24 12:44:56 | Re: Stored procedures in C |