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

Issue Type: Improvement Created: 2009-10-13T05:09:57.000+0000 Last Updated: 2012-11-20T20:52:50.000+0000 Status: Closed Fix version(s): Reporter: Jacob Oettinger (oetting) Assignee: None Tags: - Zend_Db

Related issues: - ZF-870



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.


Posted by Jacob Oettinger (oetting) on 2009-10-27T04:15:32.000+0000

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

Posted by Jacob Oettinger (oetting) on 2009-11-10T07:19:47.000+0000

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.

Posted by Rob Allen (rob) on 2012-11-20T20:52:50.000+0000

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.

Have you found an issue?

See the Overview section for more details.


© 2006-2018 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.