MySQL Stored Procedures + Yii
Posted 29 June 2009 - 12:48 PM
Would there be a benefit from having the stored procedure in MySQL rather than stored in Yii's AR?
If anybody has any suggestions, or could point me towards a resource (I couldn't find any) that would be great
Posted 29 June 2009 - 07:51 PM
Good question. I thought I saw somewhere that the AR cached queries, or something happy happened with caching, but I was skimming.
Which is why I'm considering switching that ugly query from my other thread (Making a component) to a SP, then calling it with Yii. Just wasn't sure if Yii has any more magic to help with that or not .
Posted 07 July 2009 - 07:41 AM
Really not, but it´s a good place to begin.
Yii Dao allows you to use proper funcions and command from the database. Learn this is your first step.
The second step is learn how to use PDO to configure a call to stored procedures.
After this last step, you'll just have to map you SP call to Yii Dao.
Hope this can help (sorry, I know this steps just in theory, i haven't developed it yet, so I don't have code to show you)
Posted 15 February 2011 - 05:25 PM
I think Qiang means that you should not use AR for everything you want to do.
Use SP if you have complex statements to do. If not, I recommend AR. I've done a lot of complex queries and statements usign AR with good performance.