NotificationQuery: Do not use a placeholder if it's possible to select a real value

refs #9009
This commit is contained in:
Johannes Meyer 2015-06-08 17:23:36 +02:00
parent 2669d0e478
commit 75c5aab1b9
2 changed files with 5 additions and 6 deletions

View File

@ -53,7 +53,8 @@ class HostnotificationQuery extends IdoQuery
'services' => array( 'services' => array(
'service' => 'so.name2 COLLATE latin1_general_ci', 'service' => 'so.name2 COLLATE latin1_general_ci',
'service_description' => 'so.name2', 'service_description' => 'so.name2',
'service_display_name' => 's.display_name COLLATE latin1_general_ci' 'service_display_name' => 's.display_name COLLATE latin1_general_ci',
'service_host_name' => 'so.name1'
) )
); );

View File

@ -3,7 +3,6 @@
namespace Icinga\Module\Monitoring\Backend\Ido\Query; namespace Icinga\Module\Monitoring\Backend\Ido\Query;
use Zend_Db_Expr;
use Zend_Db_Select; use Zend_Db_Select;
use Icinga\Data\Filter\Filter; use Icinga\Data\Filter\Filter;
@ -71,10 +70,9 @@ class NotificationQuery extends IdoQuery
*/ */
protected function joinHosts() protected function joinHosts()
{ {
$columns = array_keys($this->columnMap['notifications'] + $this->columnMap['hosts']); $columns = array_keys(
foreach (array_keys($this->columnMap['services']) as $column) { $this->columnMap['notifications'] + $this->columnMap['hosts'] + $this->columnMap['services']
$columns[$column] = new Zend_Db_Expr('NULL'); );
}
$hosts = $this->createSubQuery('hostnotification', $columns); $hosts = $this->createSubQuery('hostnotification', $columns);
$this->subQueries[] = $hosts; $this->subQueries[] = $hosts;
$this->notificationQuery->union(array($hosts), Zend_Db_Select::SQL_UNION_ALL); $this->notificationQuery->union(array($hosts), Zend_Db_Select::SQL_UNION_ALL);