1
irmtfan
XOOPS255 and XOOPS26 bug: cannot use this: $criteria->add(new Criteria("FIELD", "", "<>"))
  • 2013/4/10 9:11

  • irmtfan

  • Module Developer

  • Posts: 3419

  • Since: 2003/12/7


I really dont know why we cannot use empty value in criteria?

e.g.: i want to add this:
$criteria->add(new Criteria("groups""""!="));


but class xoops255/class/criteria.php dont allow it in render function.
public function render()
    {
        
$clause = (!empty($this->prefix) ? "{$this->prefix}." "") . $this->column;
        if (!empty(
$this->function)) {
            
$clause sprintf($this->function$clause);
        }
        if (
in_array(strtoupper($this->operator), array('IS NULL''IS NOT NULL'))) {
            
$clause .= ' ' $this->operator;
        } else {
            if (
'' === ($value trim($this->value))) {
                return 
'';
            }
            if (!
in_array(strtoupper($this->operator), array('IN''NOT IN'))) {
                if ((
substr($value01) != '`') && (substr($value, -1) != '`')) {
                    
$value "'{$value}'";
                } else {
                    if (!
preg_match('/^[a-zA-Z0-9_.-`]*$/'$value)) {
                        
$value '``';
                    }
                }
            }
            
$clause .= {$this->operator} {$value}";
        }
        return 
$clause;
    }


it is these lines:
if ('' === ($value trim($this->value))) {
                return 
'';
            }


I dont know why core team decide to add these?

sometimes we need this sql:
SELECT FROM `tableWHERE column IS NOT NULL AND TRIM(column) <> ''


or this:
SELECT FROM `tableWHERE column IS NOT NULL AND column <> ''


but we cannot.

Login

Who's Online

163 user(s) are online (107 user(s) are browsing Support Forums)


Members: 0


Guests: 163


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Apr 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits