ZF-39: Zend_Db_Table For Update


I would like to suggest allowing the fetch/find methods of Zend_Db_Table to accept a $forUpdate boolean parameter.

That is in Zend_Db_Table:

function find($val) // would become
function find($val, $forUpdate = false)

function fetchRow($where = null, $order = null) // would become
function fetchRow($where = null, $order = null, $forUpdate = false)

function fetchAll($where = null, $order = null, $count = null, $offset = null) // would become
function fetchAll($where = null, $order = null, $count = null, $offset = null, $forUpdate = false)

Note: Zend_Db_Table::find() would especially benefit from this syntax.

This would make it much easier for developpers to keep database integrity and would also make the Zend_Db_Table more widely accepted.


There should also be support for SELECT ... LOCK IN SHARE, and the corresponding locking modes in SQLite ( ), and similar for the other adapters. This issue is closely related to, and overlaps with, [ZF-40], although I believe [ZF-40] should be a higher priority.

Changing fix version to 0.8.0.

Recategorize as Zend_Db_Table component.

'FOR UPDATE' can now be passed to a Zend_Db_Table find/fetch operation by passing the Zend_Db_Table_Select query. See ZF1.5 PR1 or newer.