On 4/14/07, Bill Moseley <[EMAIL PROTECTED]> wrote:
> So when that die is called the transaction is rolled back and nothing
> sub outer() or do_stuff_and_send_mail() did is in the database.  But,
> the mail still got sent (probably saying something happened that
> didn't.)

It sound like you want a way to make non-transactional things outside
of the database transactional, so that the entire request succeeds or
fails.  There used to be a whole category of software dedicated to
this, called TP Monitors.

I usually keep database transactions as short as possible to help
concurrency, so I wouldn't wrap a whole request in a transaction.  The
need for that depends on your application.

> That's why it might make sense to stuff things like sending mail onto
> an array in the stash to run if there's no exceptions.

That sounds like a decent compromise between complexity and risk.  A
more complicated approach would be to write (or find) a transactional
API for all the things you want to do, e.g. an e-mail class that
doesn't actually send until it gets a commit().  In some cases, the
object can keep track of what it did and provide a rollback() method.
It's a heavy approach, and a lot of work.

I still don't think this has much to do with nested database
transactions though :)  You could hit the same issue with one
transaction or no database at all.

- Perrin

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Rose-db-object mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/rose-db-object

Reply via email to