Add sensible operation names to XML query syntax

XML 쿼리 문법에서 사용되는 operation 이름을 상식적으로 개선함

차이점을 이해하기 어려운 excess/more, below/less 조건을 다른 프레임워크에서
흔히 사용하는 gt (greater than), gte (greater than or equal to),
lt (less than), lte (less than or equal to) 라는 이름으로도 쓸 수 있도록 함.
실제 부등호는 XML 태그에 사용되므로 아직은 사용 불가...

not_in은 있는데 not_equal, not_null, not_like는 없는 문제를 개선함.
이제 위의 4가지 모두 언더바(_)를 넣든 안 넣든 동일한 의미로 쓸 수 있음.
This commit is contained in:
Kijin Sung 2018-06-30 16:01:44 +09:00
parent efa1b603c4
commit 3aaa0c60b2

View file

@ -122,13 +122,18 @@ class Condition
case 'more' :
case 'excess' :
case 'less' :
case 'below' :
case 'below' :
case 'gte' :
case 'gt' :
case 'lte' :
case 'lt' :
case 'like_tail' :
case 'like_prefix' :
case 'like' :
case 'notlike_tail' :
case 'notlike_prefix' :
case 'notlike' :
case 'not_like' :
case 'in' :
case 'notin' :
case 'not_in' :
@ -137,6 +142,7 @@ class Condition
case 'xor':
case 'not':
case 'notequal' :
case 'not_equal' :
// if variable is not set or is not string or number, return
if(!isset($this->_value))
{
@ -167,7 +173,8 @@ class Condition
break;
}
case 'null':
case 'notnull':
case 'notnull':
case 'not_null':
break;
default:
// If operation is not one of the above, means the condition is invalid
@ -190,19 +197,23 @@ class Condition
switch($operation)
{
case 'equal' :
case 'equal' :
return $name . ' = ' . $value;
break;
case 'more' :
case 'more' :
case 'gte' :
return $name . ' >= ' . $value;
break;
case 'excess' :
case 'excess' :
case 'gt' :
return $name . ' > ' . $value;
break;
case 'less' :
case 'less' :
case 'lte' :
return $name . ' <= ' . $value;
break;
case 'below' :
case 'below' :
case 'lt' :
return $name . ' < ' . $value;
break;
case 'like_tail' :
@ -212,6 +223,7 @@ class Condition
case 'notlike_tail' :
case 'notlike_prefix' :
case 'notlike' :
case 'not_like' :
return $name . ' NOT LIKE ' . $value;
break;
case 'in' :
@ -221,10 +233,12 @@ class Condition
case 'not_in' :
return $name . ' NOT IN ' . $value;
break;
case 'notequal' :
case 'notequal' :
case 'not_equal' :
return $name . ' <> ' . $value;
break;
case 'notnull' :
case 'notnull' :
case 'not_null' :
return $name . ' IS NOT NULL ';
break;
case 'null' :