On 26 Feb 2010, at 9:25pm, Francisco Azevedo wrote:

> I started with a auxiliar table with same columns,
> then, before edition i clean auxiliar data and copy from original:
> 
> delete from _table; insert into _table select * from table;
> 
> now, user can edit table (inserts, deletes, updates) and then, if we
> want to apply changes i copy back:
> 
> delete from table; insert into table select * from _table;
> 
> if we don't want to preserve, i don't need to do anything because on new
> edit, auxiliar table will be cleaned again.
> 
> This works but it's not efficient at all (imagine table with 1.000.000
> records). My question is, what is the best approach to do such thing?

You only have that solution and one other: remember the table as it was at a 
certain point (call it a backup), and every command given since then.  If you 
want to undo a command, restore the backup version of the table then replay all 
the commands up to that one you want to undo.  The 'certain point' mentioned 
above, of course, might be the original creation of the table: back to the time 
when it had no rows.

Those two systems are really your only options which will correctly cope with 
any kind of SQL commands.  If your application has reduced possibilities, and 
you can be sure that only certain types of SQL commands will be given, then you 
may have other options.

Simon.
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to