Re: Avoiding triggers
Posted in 1996
Most excellent solution. Depending on the circumstances, may be costly. Still, very good solution. I did something similar this way: A control table needs to be updated by everyone. However, we don't want anyone but informix to ever decrease a value in that table. Problem: How to create a database level control that prevents certain users from updating the table with a value less than the current value. Solution: create a table that serves two purposes. First, to log all decreases. Second, to prevent unauthorized decreases. How: Allow only informix (or other controlled users) to insert/update the new "security" table. Create a trigger on the first control table that, when the after value < before value, inserts user/data info into security table. Gotchas: Since you can not revoke perms from informix and the trigger carries the permissions of its creator, you have to create the rtigger as someone else and then revoke that someones perms from the security table. Result: It works great. It has made our application managers happy that they can not, inadvertantly, corrupt critical info, and it has pointed a finger at those who have tried. cludwigsen@harrahs.com Chuck Ludwigsen