Re: SPI_execute (result of a select statement) - Mailing list pgsql-general

From Martijn van Oosterhout
Subject Re: SPI_execute (result of a select statement)
Date
Msg-id 20060901063223.GB12644@svana.org
Whole thread Raw
In response to SPI_execute (result of a select statement)  ("Jasbinder Bali" <jsbali@gmail.com>)
Responses Re: SPI_execute (result of a select statement)  ("Jasbinder Bali" <jsbali@gmail.com>)
List pgsql-general
On Fri, Sep 01, 2006 at 02:24:32AM -0400, Jasbinder Bali wrote:
> Hi,
>
> While using SPI_execute for a select statement, how do we store the result
> returned by select statement (say a C variable)?
> SPI_execute returns different values for success or failure only as per the
> postgres manual.

Did you read the whole page?

http://www.postgresql.org/docs/8.1/interactive/spi-spi-execute.html

Especially the bit where it says:

  If the return value of the function is SPI_OK_SELECT then you may use
  the global pointer SPITupleTable *SPI_tuptable to access the result
  rows.

From there you can get the data. There's also the helper functions like
SPI_getvalue().

http://www.postgresql.org/docs/8.1/interactive/spi-interface-support.html

Hope this helps,
--
Martijn van Oosterhout   <kleptog@svana.org>   http://svana.org/kleptog/
> From each according to his ability. To each according to his ability to litigate.

Attachment

pgsql-general by date:

Previous
From: "Jasbinder Bali"
Date:
Subject: SPI_execute (result of a select statement)
Next
From: "Harpreet Dhaliwal"
Date:
Subject: Trigger (Transaction related)