Fix #1202 allow REGEXP operator in XML query

This commit is contained in:
Kijin Sung 2019-11-23 12:18:25 +09:00
parent b1e01b0fc5
commit 5ddf928869

View file

@ -122,18 +122,19 @@ class Condition
case 'more' : case 'more' :
case 'excess' : case 'excess' :
case 'less' : case 'less' :
case 'below' : case 'below' :
case 'gte' : case 'gte' :
case 'gt' : case 'gt' :
case 'lte' : case 'lte' :
case 'lt' : case 'lt' :
case 'like_tail' : case 'like_tail' :
case 'like_prefix' : case 'like_prefix' :
case 'like' : case 'like' :
case 'notlike_tail' : case 'notlike_tail' :
case 'notlike_prefix' : case 'notlike_prefix' :
case 'notlike' : case 'notlike' :
case 'not_like' : case 'regexp' :
case 'notregexp' :
case 'in' : case 'in' :
case 'notin' : case 'notin' :
case 'not_in' : case 'not_in' :
@ -142,7 +143,7 @@ class Condition
case 'xor': case 'xor':
case 'not': case 'not':
case 'notequal' : case 'notequal' :
case 'not_equal' : case 'not_equal' :
// if variable is not set or is not string or number, return // if variable is not set or is not string or number, return
if(!isset($this->_value)) if(!isset($this->_value))
{ {
@ -173,7 +174,7 @@ class Condition
break; break;
} }
case 'null': case 'null':
case 'notnull': case 'notnull':
case 'not_null': case 'not_null':
break; break;
default: default:
@ -197,23 +198,23 @@ class Condition
switch($operation) switch($operation)
{ {
case 'equal' : case 'equal' :
return $name . ' = ' . $value; return $name . ' = ' . $value;
break; break;
case 'more' : case 'more' :
case 'gte' : case 'gte' :
return $name . ' >= ' . $value; return $name . ' >= ' . $value;
break; break;
case 'excess' : case 'excess' :
case 'gt' : case 'gt' :
return $name . ' > ' . $value; return $name . ' > ' . $value;
break; break;
case 'less' : case 'less' :
case 'lte' : case 'lte' :
return $name . ' <= ' . $value; return $name . ' <= ' . $value;
break; break;
case 'below' : case 'below' :
case 'lt' : case 'lt' :
return $name . ' < ' . $value; return $name . ' < ' . $value;
break; break;
case 'like_tail' : case 'like_tail' :
@ -223,9 +224,15 @@ class Condition
case 'notlike_tail' : case 'notlike_tail' :
case 'notlike_prefix' : case 'notlike_prefix' :
case 'notlike' : case 'notlike' :
case 'not_like' : case 'not_like' :
return $name . ' NOT LIKE ' . $value; return $name . ' NOT LIKE ' . $value;
break; break;
case 'regexp' :
return $name . ' REGEXP ' . $value;
break;
case 'notregexp' :
return $name . ' NOT REGEXP ' . $value;
break;
case 'in' : case 'in' :
return $name . ' IN ' . $value; return $name . ' IN ' . $value;
break; break;
@ -233,11 +240,11 @@ class Condition
case 'not_in' : case 'not_in' :
return $name . ' NOT IN ' . $value; return $name . ' NOT IN ' . $value;
break; break;
case 'notequal' : case 'notequal' :
case 'not_equal' : case 'not_equal' :
return $name . ' <> ' . $value; return $name . ' <> ' . $value;
break; break;
case 'notnull' : case 'notnull' :
case 'not_null' : case 'not_null' :
return $name . ' IS NOT NULL '; return $name . ' IS NOT NULL ';
break; break;