mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-05-08 19:42:15 +09:00
Allow passing falsey values to if="" attribute of XML queries
This commit is contained in:
parent
7c8e76b727
commit
dd4d04f409
2 changed files with 9 additions and 9 deletions
|
|
@ -138,7 +138,7 @@ class Query extends VariableBase
|
||||||
$columns = array();
|
$columns = array();
|
||||||
foreach ($this->columns as $column)
|
foreach ($this->columns as $column)
|
||||||
{
|
{
|
||||||
if ($column->ifvar && !isset($this->_args[$column->ifvar]))
|
if ($column->ifvar && empty($this->_args[$column->ifvar]))
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
@ -217,7 +217,7 @@ class Query extends VariableBase
|
||||||
}
|
}
|
||||||
|
|
||||||
// Compose the GROUP BY clause.
|
// Compose the GROUP BY clause.
|
||||||
if ($this->groupby && count($this->groupby->columns) && (!$this->groupby->ifvar || isset($this->_args[$this->groupby->ifvar])))
|
if ($this->groupby && count($this->groupby->columns) && (!$this->groupby->ifvar || !empty($this->_args[$this->groupby->ifvar])))
|
||||||
{
|
{
|
||||||
$columns = array();
|
$columns = array();
|
||||||
foreach ($this->groupby->columns as $column_name)
|
foreach ($this->groupby->columns as $column_name)
|
||||||
|
|
@ -233,7 +233,7 @@ class Query extends VariableBase
|
||||||
}
|
}
|
||||||
$result .= ' GROUP BY ' . implode(', ', $columns);
|
$result .= ' GROUP BY ' . implode(', ', $columns);
|
||||||
}
|
}
|
||||||
if ($this->groupby && count($this->groupby->having) && (!$this->groupby->ifvar || isset($this->_args[$this->groupby->ifvar])))
|
if ($this->groupby && count($this->groupby->having) && (!$this->groupby->ifvar || !empty($this->_args[$this->groupby->ifvar])))
|
||||||
{
|
{
|
||||||
$having = $this->_arrangeConditions($this->groupby->having);
|
$having = $this->_arrangeConditions($this->groupby->having);
|
||||||
if ($having !== '')
|
if ($having !== '')
|
||||||
|
|
@ -292,7 +292,7 @@ class Query extends VariableBase
|
||||||
$columns = array();
|
$columns = array();
|
||||||
foreach ($this->columns as $column)
|
foreach ($this->columns as $column)
|
||||||
{
|
{
|
||||||
if ($column->ifvar && !isset($this->_args[$column->ifvar]))
|
if ($column->ifvar && empty($this->_args[$column->ifvar]))
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
@ -344,7 +344,7 @@ class Query extends VariableBase
|
||||||
$columns = array();
|
$columns = array();
|
||||||
foreach ($this->columns as $column)
|
foreach ($this->columns as $column)
|
||||||
{
|
{
|
||||||
if ($column->ifvar && !isset($this->_args[$column->ifvar]))
|
if ($column->ifvar && empty($this->_args[$column->ifvar]))
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
@ -437,7 +437,7 @@ class Query extends VariableBase
|
||||||
foreach ($tables as $table)
|
foreach ($tables as $table)
|
||||||
{
|
{
|
||||||
// Skip
|
// Skip
|
||||||
if ($table->ifvar && !isset($this->_args[$table->ifvar]))
|
if ($table->ifvar && empty($this->_args[$table->ifvar]))
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
@ -506,7 +506,7 @@ class Query extends VariableBase
|
||||||
foreach ($index_hints as $index_hint)
|
foreach ($index_hints as $index_hint)
|
||||||
{
|
{
|
||||||
// Skip
|
// Skip
|
||||||
if ($index_hint->ifvar && !isset($this->_args[$index_hint->ifvar]))
|
if ($index_hint->ifvar && empty($this->_args[$index_hint->ifvar]))
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
@ -553,7 +553,7 @@ class Query extends VariableBase
|
||||||
foreach ($conditions as $condition)
|
foreach ($conditions as $condition)
|
||||||
{
|
{
|
||||||
// Skip
|
// Skip
|
||||||
if ($condition->ifvar && !isset($this->_args[$condition->ifvar]))
|
if ($condition->ifvar && empty($this->_args[$condition->ifvar]))
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,7 @@ class VariableBase
|
||||||
$params = array();
|
$params = array();
|
||||||
|
|
||||||
// Process the variable or default value.
|
// Process the variable or default value.
|
||||||
if ($this->ifvar && !isset($args[$this->ifvar]))
|
if ($this->ifvar && empty($args[$this->ifvar]))
|
||||||
{
|
{
|
||||||
return [$where, $params];
|
return [$where, $params];
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue