How do I add a limit to update-query in Zend Framework?

北战南征 提交于 2019-12-01 07:34:12

问题


How do I add the LIMIT 1 clause to an update when using Zend Framework?

I'm kind of forced not to use Zend_Db_Table_Abstract::update() since it executes itself unlike the sweet Zend_Db_Select-classes.

The reason to do this is just precaution and I think Zend_Db_Table_Abstract::update()'s syntax makes more sense when found in code than the more allround Zend_Db_Adapter_Abstract::query().


回答1:


You can not.

There is an issue created for this exact problem at the issue tracker. But this feature is still not implemented.




回答2:


Why would you want to do that??? If you want to update a single record you should use the records' primary key and use an

UPDATE <table> SET field=<newvalue>, ... WHERE key = <keyvalue>;

query.



来源:https://stackoverflow.com/questions/1748660/how-do-i-add-a-limit-to-update-query-in-zend-framework

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!