Welcome Guest, Not a member yet? Register   Sign In
Active Records VS Typing out the Query String
#11

[eluser]Phil Sturgeon[/eluser]
Not sure about that mddd. The point of AR is to make simple calls quickly. Tricky ones with sub-queries and advanced conditional sections are still out of the range of AR calls.

The way it's intended to be used is:

Simple select, insert, update, delete, join, etc = AR
Sub-queries, replace, on duplicate update, stored procedures, etc = Plain SQL (or a mix)

Either way, your re-useable structure is in place by using a model. It doesn't matter what the model is doing or how, it is still re-useable.
#12

[eluser]mddd[/eluser]
@Phil: That's true. AR is not for everything. But I believe that is more because AR simply doesn't have that functionality (yet). Not because it is fundamentally better to do those complex queries outside of AR.
In other words: I think it is a good idea to use AR instead of direct SQL where possible.




Theme © iAndrew 2016 - Forum software by © MyBB