mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-05-06 02:22:52 +09:00
Add 'ifvar' attribute to most query elements
XML 쿼리에서 'ifvar' 속성을 사용하여, 특정 변수가 있을 때만 유효한 테이블이나 컬럼, 인덱스 힌트 등을 지정할 수 있도록 합니다. 어떤 변수를 넣는지에 따라 <condition> 뿐 아니라 <table>, <column>, <index_hint? 등의 적용 여부도 XML 쿼리 수정 없이 자유롭게 컨트롤할 수 있게 됩니다.
This commit is contained in:
parent
1289776c97
commit
6b7486e74f
12 changed files with 88 additions and 11 deletions
|
|
@ -11,6 +11,7 @@ class VariableBase
|
|||
* Instance properties.
|
||||
*/
|
||||
public $var;
|
||||
public $ifvar;
|
||||
public $default;
|
||||
|
||||
/**
|
||||
|
|
@ -33,7 +34,11 @@ class VariableBase
|
|||
$params = array();
|
||||
|
||||
// Process the variable or default value.
|
||||
if ($this instanceof Query)
|
||||
if ($this->ifvar && !isset($args[$this->ifvar]))
|
||||
{
|
||||
return [$where, $params];
|
||||
}
|
||||
elseif ($this instanceof Query)
|
||||
{
|
||||
$is_expression = true;
|
||||
$value = '(' . $this->getQueryString($prefix, $args) . ')';
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue