Skip site navigation (1) Skip section navigation (2)

Shared Objects (Dynamic loading)

From: "Jasbinder Bali" <jsbali(at)gmail(dot)com>
To: pgsql-novice(at)postgresql(dot)org, pgsql-general(at)postgresql(dot)org
Subject: Shared Objects (Dynamic loading)
Date: 2006-08-24 05:03:43
Message-ID: a47902760608232203n77400c8ak533376e58c9c66a0@mail.gmail.com (view raw or flat)
Thread:
Lists: pgsql-generalpgsql-novice
Hi,
I have a function in which i dynamicall load my shared object and the
function definition is as follows:

----------------------------------------------------

CREATE OR REPLACE FUNCTION sp_trigger_raw_email(int4, text)
  RETURNS bool AS
'/usr/local/pgsql/jsbali/parser', 'parse_email'
  LANGUAGE 'c' VOLATILE STRICT;
ALTER FUNCTION sp_trigger_raw_email(int4,text ) OWNER TO postgres;

---------------------------------------------



function parse_email(int caseno, char *rawemail)
populates a few global variables first and then
call another function parse_header().
function parse_header() makes use of  the  global variables and then using
ECPG stores values in a table in the database.

My question is, when we try to make use of a specific function of a shared
object dynamically loaded as show above, then
would that function be able to access all global variables populated
elsewhere in the program or all the global variables can't be accessed
inside that function of the shared object.


Also, in the above function definition,
the signature of parse_email function is
parse_email(int, char*) and i am passing (int4 , text) to int as seen in the
function code pasted above.
Is text in pgsql going to match with char* or i should use some other
datatype?

Thanks and regards,
Jas

Responses

pgsql-novice by date

Next:From: Michael FuhrDate: 2006-08-24 05:41:50
Subject: Re: Shared Objects (Dynamic loading)
Previous:From: Don MorrisonDate: 2006-08-23 22:25:25
Subject: Re: Conditional INSERT: if not exists

pgsql-general by date

Next:From: Michael FuhrDate: 2006-08-24 05:41:50
Subject: Re: Shared Objects (Dynamic loading)
Previous:From: Bob PawleyDate: 2006-08-24 02:34:43
Subject: Re: Inserting Data

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group