Steve Hollis’ Blog: Practical Nested Transactions with Zend_Db and MySQL

Steve Hollis has written an interesting article about how to handle nested transactions with Zend_Db and MySQL.

He starts by covering what transactions are and why they are useful for data integrity, showing how to use them with Zend_Db. He then goes on to talk about the problem of mapping a single transaction across many model objects:

Although transactions are a useful tool, sadly they don’t always fit well into an object oriented application. It’s common to delegate the actual persistence (inserting and updating) of models to a save method which, in turn, goes on to save child objects.
Without ugly hacks which tie the models directly to the database operations, it becomes difficult to establish which object started the transaction and when it should be committed.

In order to help solve these issues, Steve introduces an extended Mysqli adapter for Zend_Db that allows for nesting, along with some notes on its usage. Life Steve, I also heartily recommend using Zend_Db_Profiler for monitoring your database queries during development.

Go have a read!

Posted by Rob on 5th March 2010 under Around the web | 1 Comment »

One Response to “Steve Hollis’ Blog: Practical Nested Transactions with Zend_Db and MySQL”

  1. Steve Hollis responded on 05 Mar 2010 at 9:09 am #

    Thanks Rob! :)