List:General Discussion« Previous MessageNext Message »
From:Ben Clewett Date:April 18 2008 9:59am
Subject:Re: History of changed rows
View as plain text  
No problem.

I do this using three triggers on Insert, Update and Delete.  Then 
update a log file who's schema starts:

CREATE TABLE ?_log (
   id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
   transact ENUM ('I','U','D') NOT NULL,
   key_from_table ??? NOT NULL,
   KEY (key_from_table),
   field_1 ?? ,
   field_2 ??,
   ...
   field_n ??

I don't know a way of copying over every field accept long-hand in the 
triggers.

Hope this is useful...

Ben


C K wrote:
> Hi all.
> How can we manage the history of changed rows in the database. I have some
> idea but not yet implemented. By using triggers to make a copy of the row
> being changed to the another table in the same db. Is there any way to only
> save the changed fields data and field name? Any other idea?
> Thanks
> CPK
> 
Thread
History of changed rowsC K18 Apr
  • Re: History of changed rowsBen Clewett18 Apr
  • Re: History of changed rowsEric Frazier18 Apr
  • Re: History of changed rowsPeter Brawley18 Apr
    • Re: History of changed rowsRob Wultsch18 Apr
      • Re: History of changed rowsC K20 Apr