[eluser]dmyers[/eluser]
Nice idea! using your sql skills! but since this is generated via ORM / CRUD this would need to be a virtual field or I would need to add some kind of "magic" field(s) to the model (hum....)
What I did for now is prepend this right to the top of the core file DB_active_rec.php around line 885 ya hacking the core isn't good but I would consider this a bug in the core source.
Then I just add "true" to the function to "not" try to escape the input.
$this->db->order_by($orderby,true);
/**
* Sets the ORDER BY value
*
* @access public
* @param string
* @param string direction: asc or desc
* @return object
*/
function order_by($orderby, $direction = '')
{
if ($direction === true) {
// doesn't handle CI "caching"
$this->ar_orderby[] = $orderby;
return $this;
}