mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-07-01 19:14:24 +02:00
DbQuery: Add getter for GROUP BY clauses
Allows to override this in a child to provide group by clauses not until they are actually required. refs #9009
This commit is contained in:
parent
4d72832933
commit
386447b847
@ -145,8 +145,9 @@ class DbQuery extends SimpleQuery
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->group) {
|
$group = $this->getGroup();
|
||||||
$select->group($this->group);
|
if ($group) {
|
||||||
|
$select->group($group);
|
||||||
}
|
}
|
||||||
|
|
||||||
$select->columns($this->columns);
|
$select->columns($this->columns);
|
||||||
@ -321,8 +322,9 @@ class DbQuery extends SimpleQuery
|
|||||||
{
|
{
|
||||||
// TODO: there may be situations where we should clone the "select"
|
// TODO: there may be situations where we should clone the "select"
|
||||||
$count = $this->dbSelect();
|
$count = $this->dbSelect();
|
||||||
if ($this->group) {
|
$group = $this->getGroup();
|
||||||
$count->group($this->group);
|
if ($group) {
|
||||||
|
$count->group($group);
|
||||||
}
|
}
|
||||||
$this->applyFilterSql($count);
|
$this->applyFilterSql($count);
|
||||||
if ($this->useSubqueryCount || $this->group) {
|
if ($this->useSubqueryCount || $this->group) {
|
||||||
@ -393,6 +395,16 @@ class DbQuery extends SimpleQuery
|
|||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the GROUP BY clause
|
||||||
|
*
|
||||||
|
* @return string|array
|
||||||
|
*/
|
||||||
|
public function getGroup()
|
||||||
|
{
|
||||||
|
return $this->group;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return whether the given table has been joined
|
* Return whether the given table has been joined
|
||||||
*
|
*
|
||||||
|
Loading…
x
Reference in New Issue
Block a user