HoststatehistoryQuery: PostgreSQL grouping...

refs #9009
This commit is contained in:
Johannes Meyer 2015-06-18 13:18:21 +02:00
parent b25d8e2f34
commit 5c19c05a8a
1 changed files with 16 additions and 2 deletions

View File

@ -114,7 +114,6 @@ class HoststatehistoryQuery extends IdoQuery
'hgo.object_id = hg.hostgroup_object_id AND hgo.is_active = 1 AND hgo.objecttype_id = 3',
array()
);
$this->select->group(array('hh.statehistory_id', 'ho.name1'));
}
/**
@ -164,6 +163,21 @@ class HoststatehistoryQuery extends IdoQuery
'so.object_id = s.service_object_id AND so.is_active = 1 AND so.objecttype_id = 2',
array()
);
$this->select->group(array('hh.statehistory_id', 'ho.name1'));
}
/**
* {@inheritdoc}
*/
public function getGroup()
{
$group = array();
if ($this->hasJoinedVirtualTable('hostgroups') || $this->hasJoinedVirtualTable('services')) {
$group = array('hh.statehistory_id', 'ho.object_id');
if ($this->hasJoinedVirtualTable('hosts')) {
$group[] = 'h.host_id';
}
}
return $group;
}
}