Welcome Guest, Not a member yet? Register   Sign In
question about models, ar, and sql strings
#1

[eluser]CI2RULZ[/eluser]
In the user guide models example, they use the activerecord approach. Do you have to use this method or can you use a simple sql string?, i.e.

$query = $this->db->query("SELECT foo, bar, baz, foofoo, foobar AS raboof, foobaz FROM exp_pre_email_addresses WHERE foo != 'oof' AND baz != 'zab' ORDER BY foobaz LIMIT 5, 100");

I want to maintain a proper mvc architecture and not simple stick sql strings in the controller (as this is bad practice), however, I'm not interested in the abstraction provided by AR.

If you can use a simple sql string, like above, how does that effect how you would work with or call that class in the controller file?

There are times that the abstraction of activerecord seems to cause more trouble then I see it's worth having, and in porting a project that already has fairly complex query strings, using it without activerecord would help speed the process.


Messages In This Thread
question about models, ar, and sql strings - by El Forum - 05-26-2011, 09:09 AM
question about models, ar, and sql strings - by El Forum - 05-26-2011, 10:26 AM
question about models, ar, and sql strings - by El Forum - 05-26-2011, 10:43 AM
question about models, ar, and sql strings - by El Forum - 05-26-2011, 10:55 AM



Theme © iAndrew 2016 - Forum software by © MyBB