Re: support for nested transactions
Alan Caulkins <[email protected]> Sun, 16 Apr 2006 17:36:55 -0500
| Newsgroups | gmane.lisp.clsql.devel |
|---|---|
| Message-ID | <[email protected]> |
On Sat, Apr 15, 2006 at 09:55:57AM -0700, Aleksandar Bakic wrote: > Here are two macros that I've been using, FWIW. > > (defmacro with-nested-transaction (args &body body) > (with-unique-names (%body) > `(flet ((,%body () ,@body)) > (if (in-transaction-p ,@args) ; assuming no side-effects in args > (,%body) > (with-transaction ,args > (,%body)))))) For anyone interested, this is basically what I do, with a little more context wrapped around the body. A macro tests if we're in a transaction, and if not, evaluates the body in one. -A -- Maxint Consulting Linux: The ultimate video game.