Thread: SPI_????

SPI_????

From
Tourtounis Sotiris
Date:
I want to ask a question that it may look totally stupid but i have stacked as
a new user of postgresql!!!

I want to take the result of a sql question of the general type "select
att0 ..." where att0 is text and to store it to a C variable of char *. I
have read that there is the SPI_exec that returns a number of the returned
tupels of the question - if the result of my question is the SPI_getvalue
could anyone show me a small example how to use it  -if it's something
else i would appreciate your advice .Thanks a priori.


                                                 SWTHRHS TOYRTOYNHS
                                                (tourtoun@csd.uch.gr)



Re: SPI_????

From
Doug McNaught
Date:
Tourtounis Sotiris <tourtoun@csd.uoc.gr> writes:

> I want to ask a question that it may look totally stupid but i have stacked as
> a new user of postgresql!!!
>
> I want to take the result of a sql question of the general type "select
> att0 ..." where att0 is text and to store it to a C variable of char *. I
> have read that there is the SPI_exec that returns a number of the returned
> tupels of the question - if the result of my question is the SPI_getvalue
> could anyone show me a small example how to use it  -if it's something
> else i would appreciate your advice .Thanks a priori.

SPI is only for C functions running inside of the database server.  Is
this what you're actually doing?

If you're making client queries from a standalone C program, the libpq
API should do what you want and is amply documented.

-Doug