[icinga-checkins] icinga.org: icingaweb2-module-director/master: Db: alias object tables for stats query
git at icinga.org
git at icinga.org
Tue Feb 2 17:43:24 CET 2016
Module: icingaweb2-module-director
Branch: master
Commit: f000059ab3ae6f89421f4dbda18085cd2df6937f
URL: https://git.icinga.org/?p=icingaweb2-module-director.git;a=commit;h=f000059ab3ae6f89421f4dbda18085cd2df6937f
Author: Thomas Gelf <thomas at gelf.net>
Date: Tue Feb 2 17:42:09 2016 +0100
Db: alias object tables for stats query
refs #11066
---
library/Director/Db.php | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/library/Director/Db.php b/library/Director/Db.php
index dbded79..474fc92 100644
--- a/library/Director/Db.php
+++ b/library/Director/Db.php
@@ -303,12 +303,12 @@ class Db extends DbConnection
$db = $this->db();
foreach ($types as $type) {
$queries[] = $db->select()->from(
- 'icinga_' . $type,
+ array('o' => 'icinga_' . $type),
array(
'icinga_type' => "('" . $type . "')",
- 'cnt_object' => "COALESCE(SUM(CASE WHEN object_type = 'object' THEN 1 ELSE 0 END), 0)",
- 'cnt_template' => "COALESCE(SUM(CASE WHEN object_type = 'template' THEN 1 ELSE 0 END), 0)",
- 'cnt_external' => "COALESCE(SUM(CASE WHEN object_type = 'external_object' THEN 1 ELSE 0 END), 0)",
+ 'cnt_object' => "COALESCE(SUM(CASE WHEN o.object_type = 'object' THEN 1 ELSE 0 END), 0)",
+ 'cnt_template' => "COALESCE(SUM(CASE WHEN o.object_type = 'template' THEN 1 ELSE 0 END), 0)",
+ 'cnt_external' => "COALESCE(SUM(CASE WHEN o.object_type = 'external_object' THEN 1 ELSE 0 END), 0)",
'cnt_total' => 'COUNT(*)',
)
);
More information about the icinga-checkins
mailing list