execute query from inside C function

Started by James Harperabout 12 years ago4 messagesgeneral
Jump to latest
#1James Harper
james.harper@bendigoit.com.au

I've googled the docs but I can't seem to make a link as to how to execute database queries from inside a C function. I'm used to having a PGconn and using the API around that, but how do I do that from inside a C function (and a bit later on, a language handler?)

Thanks

James

--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

#2Pavel Stehule
pavel.stehule@gmail.com
In reply to: James Harper (#1)
Re: execute query from inside C function

Hello

you should to use a SPI API

http://www.postgresql.org/docs/9.3/static/spi.html

http://www.postgresql.org/docs/9.3/static/spi-spi-exec.html

Regards

Pavel Stehule

2014-02-25 13:22 GMT+01:00 James Harper <james.harper@bendigoit.com.au>:

Show quoted text

I've googled the docs but I can't seem to make a link as to how to execute
database queries from inside a C function. I'm used to having a PGconn and
using the API around that, but how do I do that from inside a C function
(and a bit later on, a language handler?)

Thanks

James

--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

#3James Harper
james.harper@bendigoit.com.au
In reply to: Pavel Stehule (#2)
Re: execute query from inside C function

Hello

you should to use a SPI API

http://www.postgresql.org/docs/9.3/static/spi.html

http://www.postgresql.org/docs/9.3/static/spi-spi-exec.html

Yep just found it. I obviously didn't google hard enough.

Thanks

James

--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

#4Pavel Stehule
pavel.stehule@gmail.com
In reply to: James Harper (#3)
Re: execute query from inside C function

2014-02-25 13:36 GMT+01:00 James Harper <james.harper@bendigoit.com.au>:

Hello

you should to use a SPI API

http://www.postgresql.org/docs/9.3/static/spi.html

http://www.postgresql.org/docs/9.3/static/spi-spi-exec.html

Yep just found it. I obviously didn't google hard enough.

It is not on front

Regards

Pavel

Show quoted text

Thanks

James