I checked the manual of CI and found it supports this kind of query binding:
$sql = "SELECT * FROM some_table WHERE id = ? AND status = ? AND author = ?";
$this->db->query($sql, array(3, 'live', 'Rick'));
However I prefer the PDO style:
$sql = "SELECT * FROM some_table WHERE id = :id AND status = :status AND author = :author";
In this way the binding could be more flexible and sequence would not matter.
Does CI support that kind of binding?