Issues

ZF-8063: Attempting to nest transactions in adapters that do not support it should fail explicitly

Description

When using PDO based adapters an exception will be thrown(by PDO) if you attempt to nest transactions on backends that does not support it. Other adapters, like Mysqli, simply ignore subsequent calls to beginTransaction(), and commit everything each time commit is called.

I think all adapters should adopt the behavior exposed by PDO. The semantics of the API (beginTransaction(), commit(), and rollback()) indicate that it is possible to nest transactions. If this is not the case the adaptor should throw an exception to let the developer know that it is not possible to nest transactions.

The Zend_Db_Adapter API hides the semantics of the underlying database functions that indicate that it is not possible to nest transactions, therefore it should communicate this information in another way.

This change may be considered a BC break. The API of Zend_Db_Adapter is not changed, but the behavior of some adapters(the ones hiding the limitations of the underlying backend) is. Code depending on the adapter not throwing an exception would break.

Comments

Btw: I would be happy to implement the required changes, if they can be agreed upon.

A resolution to this issue could be implemented using a transaction count described in the related issue (ZF-870). The related issue is not concerned with the fact that some adaptors hide the fact that they do not support nested transactions.

Bulk change of all issues last updated before 1st January 2010 as "Won't Fix".

Feel free to re-open and provide a patch if you want to fix this issue.