From Sérgio Diniz (by email):
I found one thing that I really miss, is the max function, instead of using a raw query it could be already in your ORM… so I implemented it quickly:
/**
* Tell the ORM that you wish to execute a MAX query.
* Will return the max value of the choosen column.
*/
public function max($column) {
$this->select_expr('MAX('.$column.')', 'maxvalue');
$result = $this->find_one();
return ($result !== false && isset($result->maxvalue)) ? (int) $result->maxvalue : 0;
}
I only tested it in MySQL…
From Sérgio Diniz (by email):