What's the best way to group undo log entries by transaction? Is there
a function that returns the current transaction number? Or what's the
best way to set a global variable that is inserted into the undo log by
the trigger?
As background, the wiki has a great page on undo/redo:
http://www.sqlite.org/cvstrac/wiki?p=UndoRedo
But unless I misunderstand, it seems that a single transaction will
create multiple entries in the log. For example, a transaction
containing both an insert and a delete will generate two entries in the
undo log. Therefore, to undo that transaction, I need to atomically
commit the "undo" of both the insert and delete in a single transaction.
That's fine, but the log created by the example doesn't seem to indicate
which group of undo rows correspond to a single transaction. Indeed,
the word "transaction" doesn't even appear in the page.
Now, digging through the archives I see reference to a "transaction
number" here:
http://www.mail-archive.com/[email protected]/msg23962.html
Is there any explicit way to get the current transaction number? I was
hoping to see some "transaction_number()" function here, but I don't:
http://www.sqlite.org/lang_corefunc.html
If such a function did exist, then I could just update the triggers to
insert that along with the corresponding SQL.
Lacking that, what's the best way to manually to set some kind of global
variable at the start of each transaction? One way is to maintain a
separate table with a single cell containing the latest transaction
number (which I manually increment at the start of each transaction) and
then just SELECT that in the trigger sub-query, but that seems yucky.
Is there an easier way I'm missing?
Thanks!
-david
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users