Welcome Guest, Not a member yet? Register   Sign In
Problems with Active Record
#21

[eluser]TheFuzzy0ne[/eluser]
Check out the active record source. Ot my knowledge, it just uses regular expressions to escape fields (which sometimes it gets wrong so we have pass in FALSE as the second paramter). The active record class doesn't "need" to know about aliases, as it's the database that figures it out when the query is executed.

For example, there should be nothing stopping you doing something like this:
Code:
$this->db->order_by('something');
$this->db->limit(10);
$this->db->from('some_table');
$this->db->select('field1, field2, field3');

The statement is declared backwards (which you wouldn't get away with using pure SQL). The query is only compiled when you call $this->db->get(). As I said, check out the source and you'll see what I mean. Smile
#22

[eluser]jacobc[/eluser]
Line 344 and 345 of DB_active_rec.php
Code:
$match[1] = $this->_protect_identifiers($match[1]);
            $match[3] = $this->_protect_identifiers($match[3]);

Then 1246 of DB_driver.php
Code:
if (in_array($parts[0], $this->ar_aliased_tables))

It does check the aliases...
#23

[eluser]jacobc[/eluser]
And as for the order you showed... things like that don't matter because it doesn't actualy put it all together until the end... but it does process what you give it... hence aliases need to be processed...
#24

[eluser]TheFuzzy0ne[/eluser]
jacobc, you're too smart for your own good! I can now see how, where and why aliases are tracked.




Theme © iAndrew 2016 - Forum software by © MyBB