[eluser]m4rw3r[/eluser]
What you can do is to use the dbobj2orm() method of IR_base (which means that all models extending IgnitedRecord has it) to convert an object of db_result into IR_records (or whatever class is specified).
To easily make a query to the database, create an instance of IgnitedQuery, it is IR's replacement of ActiveRecord and is made as a stand alone lib too (I've just made IR_base extend IgnitedQuery to get the SQL building methods).
Example usage:
Code:
// in the model:
function &foo;()
{
// This is also the usage if you want to use it as a stand alone lib, which works perfectly fine:
$query = new IgnitedQuery();
$query->select('foo, bar'); // Just treat it as if you use CI's $this->db
// (but there are differences, at least with 1.7 of CI)
$query->from($this->table); // We make it dynamic, so we can reuse the code
$result = $query->get(); // Just as a normal CI query
return $this->dbobj2ORM($result); // now we let dbobj2ORM do its magic :)
// (pass true as the second parameter if you only want a single IR_record returned,
// otherwise the records are encapsulated in an array)
}
I do hope the sum functions work as they should, I've primarily tested all where and like statements.