Re: Who has just touched a row ?
Posted in 1999
Topics: Triggers, Constraints & Referential Integrity
> Add a column "username" to the table and a trigger on update that SET > username=USER to that row (I never used triggers and I'm not shure about > if this it's possible But that's the idea). Hope this helps. I don't believe you can do this with IDS. You could update a row in another table, but I don't think we allow updating the same row that set off a trigger. Not that I wouldn't like to see that ability...
In article <7cbcs0$mo7$1@news.xmission.com>, "Chuck Renaud" <crenaud@informix.com> wrote: > > > Add a column "username" to the table and a trigger on update that SET > > username=USER to that row (I never used triggers and I'm not shure about > > if this it's possible But that's the idea). Hope this helps. > > I don't believe you can do this with IDS. You could update a row in > another table, but I don't think we allow updating the same row that > set off a trigger. Not that I wouldn't like to see that ability... > I think it's supported in 7.3 Lyzander -----------== Posted via Deja News, The Discussion Network ==---------- http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
Lyzander Marantal wrote: > In article <7cbcs0$mo7$1@news.xmission.com>, > "Chuck Renaud" <crenaud@informix.com> wrote: > > > > > Add a column "username" to the table and a trigger on update that SET > > > username=USER to that row (I never used triggers and I'm not shure about > > > if this it's possible But that's the idea). Hope this helps. > > > > I don't believe you can do this with IDS. You could update a row in > > another table, but I don't think we allow updating the same row that > > set off a trigger. Not that I wouldn't like to see that ability... > > > > I think it's supported in 7.3 > That would be very bizarre. You would have to account for a loop and prevent it from going past a single loop. But the idea would be to have a transaction table. One which would tract database updates or in this case table updates. So you wouldn't need to worry about updating the same row with a trigger. -Mikey
Mike Segel wrote: > > Lyzander Marantal wrote: > > > In article <7cbcs0$mo7$1@news.xmission.com>, > > "Chuck Renaud" <crenaud@informix.com> wrote: > > > > > > > Add a column "username" to the table and a trigger on update that SET > > > > username=USER to that row (I never used triggers and I'm not shure about > > > > if this it's possible But that's the idea). Hope this helps. > > > > > > I don't believe you can do this with IDS. You could update a row in > > > another table, but I don't think we allow updating the same row that > > > set off a trigger. Not that I wouldn't like to see that ability... > > > > > > > I think it's supported in 7.3 > > > > That would be very bizarre. > You would have to account for a loop and prevent it from going past a > single loop. > > But the idea would be to have a transaction table. One which would > tract database updates or in this case table updates. > So you wouldn't need to worry about updating the same row with a trigger. Even 7.2x will allow you to update the triggering row so long as you do not update any of the columns updated in the triggering statement. So if the USER column were not included in the update statement the trigger CAN update the USER column. Typically if you do this the trigger will explicitely name the column(s) that cause it to fire so that the USER column can be safely updated by hand or by a stored procedure in a separate update statement. For inserts of course one would have to use DEFAULT constraints to accomplish the auditing in place (at least before 7.30 which allows insert triggers to modify the inserted row). Art S. Kagel