Different trigger flow according to which user is performing the INSERT/UPDATE
Posted on 2010-09-15
Ok, this is a little trickier than it sounds.
Basically, if someone is inserting/updating records without passing through the framework - for example just connecting to the database - I want to perform PATH A; but if someone is logged in on the website then I want to perform PATH B.
When someone is logged in on the website and performs any database activity, he will have an active session_token in a table, which will also help me to identify the username, his IP and the aforementiond session id. My framework will pass this session_token as a paramenter for every stored procedure I call.
So, how can I check, during a trigger, if the stored procedure that caused the insert/update has a given parameter?