public function range($from, $to, $include = true)
{
if ($this->isEmpty($from) && $this->isEmpty($to)) {
return '';
}
$extra = '';
if ($include) {
$extra = '=';
}
$sql = array();
if ($from) {
$sql[] = '(' . $this->getFieldName() . ' >' . $extra . ' ' . $this->db->q($from) . ')';
}
if ($to) {
$sql[] = '(' . $this->getFieldName() . ' <' . $extra . ' ' . $this->db->q($to) . ')';
}
$sql = '(' . implode(' AND ', $sql) . ')';
return $sql;
}