True, but even an application would need to "undo" in transactions, I'd 
think.  Like, if a user drags a widget from column A to B, it generates 
an INSERT in one column and a DELETE in another.  Pressing Undo once 
would leave it in both columns, which is probably unexpected.

Anyway, I was more thinking of a "transaction count" sort of variable, 
indicating how many total transactions have been committed to the 
database.  Just something to group undo log entries by transaction 
without maintaining a manual transaction identifier.

Thanks for considering it!

-david

Ken wrote:
> 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

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

Reply via email to