Embedded SQL in a function

Started by Nikolay Hristovalmost 24 years ago3 messagesgeneral
Jump to latest
#1Nikolay Hristov
charlie@mail.vega.bg

Hi,

Is it possible to use embedded SQL in C function.

I have tried application with embedded SQL and C functions
separately and they worked just fine.
When I tried to use embedded SQL in a function,
the result is that the function generally works,
but the embedded SQL statements do nothing.
There ware no errors during preprocessing, compiling and linking.

I was unable to find anything about that in the documentation.

Thanks in advance.

#2Michael Meskes
meskes@postgresql.org
In reply to: Nikolay Hristov (#1)
Re: Embedded SQL in a function

On Mon, Jul 15, 2002 at 07:28:19PM +0300, Nikolay Hristov wrote:

Is it possible to use embedded SQL in C function.

You mean an internal function?

I'm sorry, that won't work as embedded SQl internally uses libpq to
talk to the backend. When you're inside the backend you would need to
use the SPI interface instead. I always wanted to add that to ecpg but
never found the time.

Michael
--
Michael Meskes
Michael@Fam-Meskes.De
Go SF 49ers! Go Rhein Fire!
Use Debian GNU/Linux! Use PostgreSQL!

#3Nikolay Hristov
charlie@mail.vega.bg
In reply to: Michael Meskes (#2)
Re: Embedded SQL in a function

Michael Meskes wrote:

On Mon, Jul 15, 2002 at 07:28:19PM +0300, Nikolay Hristov wrote:

Is it possible to use embedded SQL in C function.

You mean an internal function?

I'm sorry, that won't work as embedded SQl internally uses libpq to
talk to the backend. When you're inside the backend you would need to
use the SPI interface instead. I always wanted to add that to ecpg but
never found the time.

Michael

Thank you for the responce.
I suppose I should rewrite my DB2 stored procedures in PL/pgSQL.
I hoped that there is an easy way.

Regards,
Nikolay