About the auto increment I meant the mysql column property AI.

About undo:
In that case if you don't save your sessions to table and the session is
lost it's impossible to undo.

Usually undo implemented with the state pattern.

But in your case , I'll recommend keeping the initial data locally or to
undo table  that will hold update statements.

1. undo table:
table_name
row_id
update_statement

2.Before editing a table1 create an update statement for each row and insert
it to the update table.
insert into undo ('table1',1,'update table table1 set col1= 'old_val', ....
where id = 1' );

3.update the table1
4. undo
   a) select id from table 1 where id not in (select row_id from undo where
table_name = 'table1' )
       delete all the rows you get, these are all new rows.
    b) run all update  statements from undo table
        If you get an error  change the update statement to insert
statement, the user probably delete this row.
5. delete from undo where table_name = 'table1';

If you add user id to this process each user will be able to undo only his
changes.

I think its better to implement it with before update, after insert and
before delete mysql  triggers.
This way you save only changed rows.

Its just a sketch so don't take it as it is, think it over

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected] For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en

Reply via email to