mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-03 16:51:40 +09:00
Support "if" in <group> inside <groups> #2595
This commit is contained in:
parent
386f93fc6c
commit
51762315de
4 changed files with 19 additions and 2 deletions
|
|
@ -175,9 +175,10 @@ class DBQueryParser extends BaseParser
|
|||
foreach ($xml->groups->children() as $tag)
|
||||
{
|
||||
$name = $tag->getName();
|
||||
$ifvar = trim($tag['if'] ?? '') ?: null;
|
||||
if ($name === 'group')
|
||||
{
|
||||
$query->groupby->columns[] = trim($tag['column'] ?? '');
|
||||
$query->groupby->columns[] = [trim($tag['column'] ?? ''), $ifvar];
|
||||
}
|
||||
elseif ($name === 'having')
|
||||
{
|
||||
|
|
|
|||
|
|
@ -222,6 +222,14 @@ class Query extends VariableBase
|
|||
$columns = array();
|
||||
foreach ($this->groupby->columns as $column_name)
|
||||
{
|
||||
if (is_array($column_name))
|
||||
{
|
||||
list($column_name, $ifvar) = $column_name;
|
||||
if ($ifvar && empty($this->_args[$ifvar]))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if (self::isValidColumnName($column_name))
|
||||
{
|
||||
$columns[] = self::quoteName($column_name);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue