C-function and query
C-function and query
От:
"Martina Mostert" <martina_mostert@gmx.de>
Дата:
For our database for project-management I need a function which on the one hand is able to do a query on a table and on the other hand can search for files outside the database somewhere in the directories of the computer. This function has to be executed by a trigger. Because I'm well known to c/c++, which is also a kind of standard with us, I'd like to use a c-function for the directory job. As I didn't find any possibility to execute a query out of a c-function - which I would prefer - in the documentation (or am I wrong?) I tried to write a function in pl/pgsql that is executed by the trigger and does the query and that should pass the result to a c-function for the rest. But unfortunatly the function call of my c-function ends up in an error message. So does that mean that such a combination isn't allowed or is there anything special I have to care for when executing a c-function out of a pl/pgsql function? I used the version-1 calling conventions for the c-function, compiled and linked it as a dynamically-loaded function and registered it with create function in the database. If that all doesn't work, is there any other possibility for solving the problem? Thanks Martina
Re: C-function and query
От:
Tom Lane <tgl@sss.pgh.pa.us>
Дата:
"Martina Mostert" writes: > As I didn't find any possibility to execute a query out of > a c-function - which I would prefer - in the documentation > (or am I wrong?) SPI - see http://www.ca.postgresql.org/users-lounge/docs/7.2/postgres/spi.html There are usage examples in contrib. > I tried > to write a function in pl/pgsql that is executed by the > trigger and does the query and that should pass the result > to a c-function for the rest. But unfortunatly the function > call of my c-function ends up in an error message. So does > that mean that such a combination isn't allowed No, it means there's a bug in your c function. regards, tom lane
Re: C-function and query
От:
"Martina Mostert" <martina_mostert@gmx.de>
Дата:
On 8 Aug 2002 at 9:27, Tom Lane wrote: > "Martina Mostert" writes: > > As I didn't find any possibility to execute a query out of > > a c-function - which I would prefer - in the documentation > > (or am I wrong?) > > SPI - see > http://www.ca.postgresql.org/users-lounge/docs/7.2/postgres/spi.html > There are usage examples in contrib. Ok, sometimes I'm simply blind. Thank you. Martina