SQLite Forum

About automatic undo/redo
Login

About automatic undo/redo

(1.1) By tom (younique) on 2021-05-13 22:12:33 edited from 1.0 [source]

By incident, I stumbled upon the automatic undo/redo suggestion for SQLite databases. Very interesting and clever solution!

I'd like to known why you chose temporary triggers and a temporary table. As far as I understand, temporary tables and triggers are limited to the connection in which they were created. This means that a permanent connection has to be kept to allow undoing an operation. Wouldn't it be easier to keep those in triggers and the table in the database itself and delete the log when terminating the app?

And shouldn't table and column names be put in double quotes?

e.g.: set sql "CREATE TEMP TRIGGER ^_${tbl}_it^ AFTER INSERT ON ^$tbl^ BEGIN\n"

(I've used the ^ sign to indicate where I had put double quotes)