On Wed, Feb 22, 2012 at 8:10 PM, Roger Binns <rog...@rogerbinns.com> wrote:
> > The second is to ensure you have an undo mechanism, as this will affect > your schema and triggers. One thing I worked on didn't even have a 'save' > menu item. Every action you did resulted in a database change. You could > easily undo these. You could also see of the objects as they were at any > prior point in time, being able to undo or redo any change. > Here <http://www.sqlite.org/cvstrac/wiki?p=UndoRedo> is a write-up from 2005 in which I describe a technique I used to implement unlimited-depth undo/redo in a application that used SQLite as its file format. There was no "File/Save" button. But you could undo as far back as you wanted - even in to prior sessions. That application was written in Tcl/Tk, but the idea works the same in D or whatever language you want to use. Another approach is to record historical versions of rows in the database somehow. In other words, design your schema as if it were a Version Control System <http://en.wikipedia.org/wiki/Revision_control> that keeps a permanent record of past images of the data. Bonus points if you can make it operate as a Distributed Version Control System<http://en.wikipedia.org/wiki/Distributed_Version_Control_System>. Note that Monotone <http://www.monotone.ca/> was a pioneer in the DVCS space and their file format is an SQLite database. Note also that SQLite itself is maintained using Fossil<http://www.fossil-scm.org/index.html/doc/trunk/www/index.wiki>which is another DVCS that uses an SQLite database for storage. (Yes, the source code for SQLite is stored in an SQLite database. Recursion is a wonderful thing.) Or, you could do all your work inside a transaction and then implement a File/Save button that does a COMMIT for you. That approach is conceptually simpler from the point of view of the programmer. But it is less intuitive to users. And if your application crashes, you lose all of your work done since the last File/Save. If you do use this approach, please note that SQLite does support nested transaction<http://www.sqlite.org/lang_savepoint.html>which might be useful to you. -- D. Richard Hipp d...@sqlite.org _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users