the Undo/Redo mechanism described is not really for transactions but rather a 
"Button" within an application. So that the user can undo/redo changes.

Only one transaction can be active at a time. So to the best of my knowledge 
there is no "transaction number" as there can be only 1. Now you may go ahead 
and implement "pseudo transactions" and implement your own transaction number.  
etc...

HTH,
Ken


David Barrett <[EMAIL PROTECTED]> wrote: 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/sqlite-users@sqlite.org/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
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

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

Reply via email to