[CDBI] Transactions between HTTP requests?

Carlos Vicente cvicente at network-services.uoregon.edu
Wed Mar 8 17:56:25 GMT 2006


Hi all,

I recently converted my MySQL tables from myISAM to InnoDB and
implemented the do_transaction method shown in the wiki:

http://wiki.class-dbi.com/wiki/Using_transactions

for certain operations that required atomic updates.  That works just
fine.  Thanks for the tip!

Now, there's another case where I thought transactions would solve a
particular problem, but I'm not sure it's a good idea, or if it's even
possible:  A web user executes a Mason component that calls a library
method which performs a lot of DB operations (insert, delete, update)
and the component returns output from the method that tells the user
what happened.  Now, I'd like to be able to let the user 'undo' all the
operations if he's not satisfied with the results.  The problem, as you
may have already guessed, is that the user has to issue a new HTTP
request, which might end up using a different Apache client process in
which the transaction context does not exist (AutoUpdate is still ON,
etc).  I've tested it configuring Apache to fork only one process and it
works fine, but that's not a solution.

So, I guess the two questions are: Is it possible to do this somehow,
and if so, is it a good idea?  

Thanks a lot in advance,

cv





More information about the ClassDBI mailing list