Re: Triggers & SQL
Posted in 2000
Topics: Stored Procedures & SPL, Triggers, Constraints & Referential Integrity
Matthew Smith wrote: > Hello, > > I have RTFM and searched the archives but to no avail. Is there a method > to determine the program name of the process which invokes a trigger > using SPL? I want to perform a different task depending on the program > invoking a trigger. For example, > > when prog1.4gi invokes trigger then perform task1, > when prog2.4gi invokes trigger then perform task2. No can do. Hmm unless you add a column to the table that the app can populate with a "I am me!" indicator so the trigger or SPL can examine it. Art S. Kagel
In article <3890B1AC.6A414F60@bloomberg.net>, "Art S. Kagel" <kagel@bloomberg.net> wrote: > Matthew Smith wrote: > > > Hello, > > > > I have RTFM and searched the archives but to no avail. Is there a method > > to determine the program name of the process which invokes a trigger > > using SPL? I want to perform a different task depending on the program > > invoking a trigger. For example, > > > > when prog1.4gi invokes trigger then perform task1, > > when prog2.4gi invokes trigger then perform task2. > > No can do. Hmm unless you add a column to the table that the app can > populate with a "I am me!" > indicator so the trigger or SPL can examine it. > > Art S. Kagel > > I believe it is possible. Complicated, slow, of course not for OLTP, but possible if you want to catch something. AFAIK dbinfo('sessionid') in stored procedure called from let say insert trigger will return information about session that is trying to insert. Then you can get UNIX pid of process. Then name of process (if it is local :) Will you try? :) Regards Vardan -- Vardan Aroustamian vaar@geocities.com Sent via Deja.com http://www.deja.com/ Before you buy.
In article <3890B1AC.6A414F60@bloomberg.net>, Art S. Kagel wrote: >Matthew Smith wrote: > >> when prog1.4gi invokes trigger then perform task1, >> when prog2.4gi invokes trigger then perform task2. > >No can do. On a similar note, what about detecting if the triggering statement was inside a stored procedure, and retrieving the name of this procedure. This looks impossible too, but I'm not familiar with the informix side channels. TTFN -- Roger.