Unix Technical Forum

History of changed rows

This is a discussion on History of changed rows within the MySQL General forum forums, part of the MySQL category; --> Hi all. How can we manage the history of changed rows in the database. I have some idea but ...


Go Back   Unix Technical Forum > Database Server Software > MySQL > MySQL General forum

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-19-2008, 06:19 AM
C K
 
Posts: n/a
Default History of changed rows

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

--
Keep your Environment clean and green.

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 04-19-2008, 06:19 AM
Ben Clewett
 
Posts: n/a
Default Re: History of changed rows

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
>

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 04-19-2008, 06:20 AM
Eric Frazier
 
Posts: n/a
Default Re: History of changed rows

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
>

How about mysqlbinlog?

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 04-19-2008, 06:20 AM
Peter Brawley
 
Posts: n/a
Default Re: History of changed rows

CK,

>How can we manage the history of changed rows in the database.


Point-in-time architecture. For a bit of discussion see
http://www.artfulsoftware.com/infotree/tip.php?id=547

PB

-----

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
>
>
> ------------------------------------------------------------------------
>
> No virus found in this incoming message.
> Checked by AVG.
> Version: 7.5.519 / Virus Database: 269.23.1/1385 - Release Date: 4/18/2008 9:30 AM
>


Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 04-19-2008, 06:20 AM
Rob Wultsch
 
Posts: n/a
Default Re: History of changed rows

On Fri, Apr 18, 2008 at 8:13 AM, Peter Brawley <peter.brawley@earthlink.net>
wrote:

> CK,
>
> > How can we manage the history of changed rows in the database.
> >

>
> Point-in-time architecture. For a bit of discussion see
> http://www.artfulsoftware.com/infotree/tip.php?id=547
>
> PB



I have used this convention and it works well.

I have a real problem with how it suggests using NULL. NULL is undefined,
and they are basically abusing it to mean infinite positive. NULL has issues
being indexed, big datetime values don't.

At the recent postgres convention I eavesdropped on a discussion about a
possible new temporal range format which would basically consist of a start
date and an end date and preclude any other entries from overlapping. Such
a format would be ideal for PITA, but the start and end would need to be not
null...

--
Rob Wultsch
wultsch@gmail.com
wultsch (aim)

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)  
Old 04-20-2008, 06:10 PM
C K
 
Posts: n/a
Default Re: History of changed rows

Thanks for all of you. I will test the suggestions and then reply.
CPK


--
Keep your Environment clean and green.

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 05:11 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com