2008年12月20日星期六

Re: [fw-db] Stored procedures caller.

I`m using MySQL Stored Routines quite regular although I can`t answer your
question why people don`t use them as often.

Maybe because MySQL Stored Routines language is procedural, looks old and
lacks many features (debugging is a pain) or maybe SP generally are slow
(parser) or there are no cool GUI Tools to help manage SP and test them...
or maybe PHP devs want to play with PHP only? It`s easy to write simple
wrapper to MySQL in PHP and build queries fast allong with other PHP code.
So you have one editor and no need for switching between others.

I use stored procedures for complex inserts, deletes and updates where I
need to check many stuff before I commit the operation. Each procedure
return code number and message with one select as a result. I see no problem
using SP this way.
As I don`t like triggers (it`s easy to use them too often and get confused
which part is responsible for which task) I very often use SP to do what
triggers normally are for. It`s just my habbit to do so and find it easier
to maintain the application code.
For complex, often used queries with many joins I use views. Also see here
no problems using them.

In SP I also like that they help me make my PHP code (modules) a bit
thinner. If I want to add something and I know where... let DB engine take
care of inserting it in a proper way.

I`m waiting for stable release of PHP 5.3 which should include mysqlnd
driver with fixed SP issues to play more with DB stored code.


--
View this message in context: http://www.nabble.com/Stored-procedures-caller.-tp10147171p21107173.html
Sent from the Zend DB mailing list archive at Nabble.com.

没有评论: