Re: Packages in oracle Style
От | Joe Conway |
---|---|
Тема | Re: Packages in oracle Style |
Дата | |
Msg-id | 48416FA8.40008@joeconway.com обсуждение исходный текст |
Ответ на | Re: Packages in oracle Style (<coutinho@mondriantecnologia.com>) |
Ответы |
Re: Packages in oracle Style
|
Список | pgsql-hackers |
coutinho@mondriantecnologia.com wrote: > I have implemented a solution for global variables implemented in plpython and I need implement this in c :) The below listed tarball is out of date at this point, but I have updated code laying around if someone really wanted it: http://www.joeconway.com/sessfunc.tar.gz I've used variations of this over the years on several projects. I've also (mis)used custom configs, e.g. in a plpgsql function: 8<---------------------------- EXECUTE 'set myvars.var1 to ''' || p_var1 || ''''; 8<---------------------------- and in your "get session var" C function: 8<---------------------------- #define GET_SESSVAR_BY_NAME(SESS_VAR_NAME) \ do { \ SESS_VAR_NAME = GetConfigOptionByName("myvars." #SESS_VAR_NAME,\ NULL); \ if (!SESS_VAR_NAME) \ elog(ERROR,"Missing session variable: " #SESS_VAR_NAME); \ } while (0) char *var1 = GET_SESSVAR_BY_NAME(var1); 8<---------------------------- Joe
В списке pgsql-hackers по дате отправления: