MySQL stored procedures or php code?

前端 未结 11 810
伪装坚强ぢ
伪装坚强ぢ 2020-12-29 14:35

A general question, without a specific case in mind - is it usually preferred to use MySQL stored procedures over writing a PHP script that performs the same calculations an

11条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-29 15:25

    I think Jeff Atwood hit the nail on the head in 2004 regarding stored procs:

    Who Needs Stored Procedures, Anyways?

    Having used both stored procedures and dynamic SQL extensively I definitely prefer the latter: easier to manage, better encapsulation, no BL in the data access layer, greater flexibility and much more. Virtually every major open-source PHP project uses dynamic SQL over stored procs (see: Drupal, Wordpress, Magento and many more).

    This conversation almost seems archaic: get yourself a good ORM, stop fretting over your data access and start building awesome applications.

提交回复
热议问题