• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Problems with Active Record

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:
$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

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

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

It does check the aliases...

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...

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

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.