Re: Linux fgl_getenv
Posted in 2003
Topics: Stored Procedures & SPL, Platform-Specific Issues
Glen Johnson wrote: > Thanks, what do I use within a stored procedure to get environmental > variables then? A system call to getenv? Usually, you don't get environment variables at all. Which one(s) do you think you need access to, and why? As I at least hinted, any environment found by something run by the server is primarily the server's own environment. Anything else is unreliable. -- Jonathan Leffler #include <disclaimer.h> Email: jleffler@earthlink.net, jleffler@us.ibm.com Guardian of DBD::Informix v2003.04 -- http://dbi.perl.org/
> Usually, you don't get environment variables at all. Which one(s) do > you think you need access to, and why? As I at least hinted, any > environment found by something run by the server is primarily the > server's own environment. Anything else is unreliable. I want to set a variable to selectively turn various trace statements on and off in stored procedures.
Glen Johnson wrote: >>Usually, you don't get environment variables at all. Which one(s) do >>you think you need access to, and why? As I at least hinted, any >>environment found by something run by the server is primarily the >>server's own environment. Anything else is unreliable. > > I want to set a variable to selectively turn various trace statements on and > off in stored procedures. Yes - I was afraid of something like that. For session A, you want it on; for session B, you want it off. Per-session environment variables are not supported - there basically isn't a way to get them from your client to the server. Yes, some variables are transferred during a connection. No, you can't control which ones. Further, the variables that are sent are stashed in a session control block, and not placed in the environment of the server - not in the sense of getenv(). So, there is no simple way to achieve what you are after. Maybe your best bet is a global variable which can be manipulated by a stored procedure which you call to adjust things. You'd have to review how the SPs being traced know what to do - is that a global setting or is it a per-procedure setting. -- Jonathan Leffler #include <disclaimer.h> Email: jleffler@earthlink.net, jleffler@us.ibm.com Guardian of DBD::Informix v2003.04 -- http://dbi.perl.org/