joomla/joomla-platform — pull request #1640 by okonomiyaki3000 (2012-10-25 07:22:44+00:00)
Title: Handle nested transactions

Transactions need to support 'nesting' (actually save points) so that mistakes like this don't happen:

```php
$db->transactionStart();

// do stuff

SomeFunction();

// oops, need to rollback for some reason
$db->transactionRollback();
// Oh no! It was already commited because:

/****** Elsewhere... ********/
function SomeFunction()
{
// I don't know that we already started a transaction so I'll try to start one.
$db->transactionStart();
// Hmm. Seems fine. Do stuff.

// All good, let's commit. I think I'm just committing my stuff because I don't know anything!
$db->transactionCommit();
}
```

I'm sure this situation never happens in Joomla but let's make sure it never can happen.