Here is my query in Codeigniter
$this->db->select(\'p.*,u.firstname, u.lastname,s.title AS industry, pt.type_name , al.length_value\',
I tested today and it's working.
You can use it like you said whenever you use the second parameter FALSE to disable escaping.
$this->db->order_by("CASE p.submit_to WHEN '' THEN 0 WHEN 'writer' THEN 1 ELSE 2 END, p.request_end_date asc",FALSE);
Greetings.