DbQuery: Do not call Zend_Db_Select::columns() unless it's necessary

This makes it possible to just use a DbQuery as "union container" without
ever calling from() on it.
This commit is contained in:
Johannes Meyer 2015-12-03 13:53:34 +01:00
parent 28cd9681c8
commit 5be48fc923

View File

@ -153,7 +153,10 @@ class DbQuery extends SimpleQuery
$select->group($group); $select->group($group);
} }
$select->columns($this->columns); if (! empty($this->columns)) {
$select->columns($this->columns);
}
$this->applyFilterSql($select); $this->applyFilterSql($select);
if ($this->hasLimit() || $this->hasOffset()) { if ($this->hasLimit() || $this->hasOffset()) {
@ -333,7 +336,9 @@ class DbQuery extends SimpleQuery
$this->applyFilterSql($count); $this->applyFilterSql($count);
$group = $this->getGroup(); $group = $this->getGroup();
if ($this->useSubqueryCount || $group) { if ($this->useSubqueryCount || $group) {
$count->columns($this->columns); if (! empty($this->columns)) {
$count->columns($this->columns);
}
if ($group) { if ($group) {
$count->group($group); $count->group($group);
} }