[icinga-checkins] icinga.org: icinga-api/r1.2: * Added some default joins that caused pgsql to throw errors

git at icinga.org git at icinga.org
Wed Sep 29 17:54:50 CEST 2010


Module: icinga-api
Branch: r1.2
Commit: e508d5bc77e3309d2649c36ff1cb1b79a21032b8
URL:    https://git.icinga.org/?p=icinga-api.git;a=commit;h=e508d5bc77e3309d2649c36ff1cb1b79a21032b8

Author: jmosshammer <jannis.mosshammer at netways.com>
Date:   Wed Sep 29 17:28:49 2010 +0200

* Added some default joins that caused pgsql to throw errors

---

 .../data_interfaces/IcingaApiSearchIdoPgsql.php    |   38 ++++++++++----------
 1 files changed, 19 insertions(+), 19 deletions(-)

diff --git a/objects/search/data_interfaces/IcingaApiSearchIdoPgsql.php b/objects/search/data_interfaces/IcingaApiSearchIdoPgsql.php
index c1fcb28..39a66e7 100644
--- a/objects/search/data_interfaces/IcingaApiSearchIdoPgsql.php
+++ b/objects/search/data_interfaces/IcingaApiSearchIdoPgsql.php
@@ -41,9 +41,9 @@ class IcingaApiSearchIdoPgsql
 				distinct ${FIELDS}
 			from
 				${TABLE_PREFIX}objects AS oh
-			${if_table:h:inner join ${TABLE_PREFIX}hosts AS h on h.host_object_id = oh.object_id}
-			${if_table:hs:inner join ${TABLE_PREFIX}hoststatus AS hs on hs.host_object_id = oh.object_id}
-			${if_table:i,h:inner join ${TABLE_PREFIX}instances AS i on i.instance_id = h.instance_id}
+			inner join ${TABLE_PREFIX}hosts AS h on h.host_object_id = oh.object_id
+			inner join ${TABLE_PREFIX}hoststatus AS hs on hs.host_object_id = oh.object_id
+			inner join ${TABLE_PREFIX}instances AS i on i.instance_id = h.instance_id
 			${if_table:hcg,h:inner join ${TABLE_PREFIX}host_contactgroups AS hcg on hcg.host_id = h.host_id}
 			${if_table:cg,h:inner join ${TABLE_PREFIX}contactgroups AS cg on cg.contactgroup_object_id = hcg.contactgroup_object_id}
 			${if_table:ocg,hcg,h:inner join ${TABLE_PREFIX}objects AS ocg on ocg.object_id = hcg.contactgroup_object_id and ocg.objecttype_id = 11}
@@ -65,13 +65,13 @@ class IcingaApiSearchIdoPgsql
 				distinct ${FIELDS}
 			from
 				${TABLE_PREFIX}objects AS os
-			${if_table:s:inner join ${TABLE_PREFIX}services AS s on s.service_object_id = os.object_id}
-			${if_table:i,s:inner join ${TABLE_PREFIX}instances AS i on i.instance_id = s.instance_id}
-			${if_table:scg,s:inner join ${TABLE_PREFIX}service_contactgroups AS scg on scg.service_id = s.service_id}
+			inner join ${TABLE_PREFIX}services AS s on s.service_object_id = os.object_id
+			inner join ${TABLE_PREFIX}instances AS i on i.instance_id = s.instance_id
+			inner join ${TABLE_PREFIX}service_contactgroups AS scg on scg.service_id = s.service_id
 			${if_table:cg,scg,s:inner join ${TABLE_PREFIX}contactgroups AS cg on cg.contactgroup_object_id = scg.contactgroup_object_id}
 			${if_table:cgm,cg,scg,s:inner join ${TABLE_PREFIX}contactgroup_members AS cgm on cgm.contactgroup_id = cg.contactgroup_id}
 			${if_table:oc,cgm,cg,scg,s:inner join ${TABLE_PREFIX}objects AS oc on oc.object_id = cgm.contact_object_id}
-			${if_table:ss:inner join ${TABLE_PREFIX}servicestatus AS ss on ss.service_object_id = os.object_id}
+			inner join ${TABLE_PREFIX}servicestatus AS ss on ss.service_object_id = os.object_id
 			${if_table:ocg,scg,s:inner join ${TABLE_PREFIX}objects AS ocg on ocg.object_id = scg.contactgroup_object_id and ocg.objecttype_id = 11}
 			${if_table:hs,s:inner join ${TABLE_PREFIX}hoststatus AS hs on hs.host_object_id = s.host_object_id}
 			${if_table:oh,s:inner join ${TABLE_PREFIX}objects AS oh on oh.object_id = s.host_object_id and oh.objecttype_id = 1}
@@ -190,9 +190,9 @@ class IcingaApiSearchIdoPgsql
 				${FIELDS:hs.current_state AS HOST_STATE, count(hs.current_state) AS COUNT}
 			from
 				${TABLE_PREFIX}hoststatus AS hs
-			${if_table:oh:inner join ${TABLE_PREFIX}objects AS oh on oh.object_id = hs.host_object_id}
-			${if_table:h,oh:inner join ${TABLE_PREFIX}hosts AS h on h.host_object_id = oh.object_id}
-			${if_table:i,h,oh:inner join ${TABLE_PREFIX}instances AS i on i.instance_id = h.instance_id}
+			inner join ${TABLE_PREFIX}objects AS oh on oh.object_id = hs.host_object_id
+			inner join ${TABLE_PREFIX}hosts AS h on h.host_object_id = oh.object_id
+			inner join ${TABLE_PREFIX}instances AS i on i.instance_id = h.instance_id
 			${if_table:hcg,h,oh:-- inner join ${TABLE_PREFIX}host_contactgroups AS hcg on hcg.host_id = h.host_id}
 			${if_table:cg,hcg,h,oh:-- inner join ${TABLE_PREFIX}contactgroups AS cg on cg.contactgroup_object_id = hcg.contactgroup_object_id}
 			${if_table:ocg,hcg,h,oh:-- inner join ${TABLE_PREFIX}objects AS ocg on ocg.object_id = hcg.contactgroup_object_id}
@@ -213,9 +213,9 @@ class IcingaApiSearchIdoPgsql
 				${FIELDS:ss.current_state AS SERVICE_STATE, count(ss.current_state) AS COUNT}
 			from
 				${TABLE_PREFIX}servicestatus AS ss
-			${if_table:os:inner join ${TABLE_PREFIX}objects AS os on os.object_id = ss.service_object_id}
-			${if_table:s,os:inner join ${TABLE_PREFIX}services AS s on s.service_object_id = os.object_id}
-			${if_table:i,s,os:inner join ${TABLE_PREFIX}instances AS i on i.instance_id = s.instance_id}
+			inner join ${TABLE_PREFIX}objects AS os on os.object_id = ss.service_object_id
+			inner join ${TABLE_PREFIX}services AS s on s.service_object_id = os.object_id
+			inner join ${TABLE_PREFIX}instances AS i on i.instance_id = s.instance_id
 			${if_table:scg,s,os:-- inner join ${TABLE_PREFIX}service_contactgroups AS scg on scg.service_id = s.service_id}
 			${if_table:cg,scg,s,os:-- inner join ${TABLE_PREFIX}contactgroups AS cg on cg.contactgroup_object_id = scg.contactgroup_object_id}
 			${if_table:cgm,cg,scg,s,os:-- inner join ${TABLE_PREFIX}contactgroup_members AS cgm on cgm.contactgroup_id = cg.contactgroup_id}
@@ -241,7 +241,7 @@ class IcingaApiSearchIdoPgsql
 				${TABLE_PREFIX}statehistory AS sh
 			inner join ${TABLE_PREFIX}objects AS oh on oh.object_id = sh.object_id and oh.objecttype_id = 1
 			inner join ${TABLE_PREFIX}hosts AS h on h.host_object_id = oh.object_id
-			${if_table:i,h:inner join ${TABLE_PREFIX}instances AS i on i.instance_id = h.instance_id}
+			inner join ${TABLE_PREFIX}instances AS i on i.instance_id = h.instance_id
 			${if_table:hcg,h:inner join ${TABLE_PREFIX}host_contactgroups AS hcg on hcg.host_id = h.host_id}
 			${if_table:cg,h:inner join ${TABLE_PREFIX}contactgroups AS cg on cg.contactgroup_object_id = hcg.contactgroup_object_id}
 			${if_table:ocg,hcg,h:inner join ${TABLE_PREFIX}objects AS ocg on ocg.object_id = hcg.contactgroup_object_id and ocg.objecttype_id = 11}
@@ -262,7 +262,7 @@ class IcingaApiSearchIdoPgsql
 				${TABLE_PREFIX}statehistory AS sh
 			inner join ${TABLE_PREFIX}objects AS os on os.object_id = sh.object_id and os.objecttype_id = 2
 			inner join ${TABLE_PREFIX}services AS s on s.service_object_id = os.object_id
-			${if_table:i,s:inner join ${TABLE_PREFIX}instances AS i on i.instance_id = s.instance_id}
+			inner join ${TABLE_PREFIX}instances AS i on i.instance_id = s.instance_id
 			${if_table:oh,s,os:inner join ${TABLE_PREFIX}objects AS oh on oh.object_id = s.host_object_id}
 			${if_table:h,oh,s,os:inner join ${TABLE_PREFIX}hosts AS h on h.host_object_id = oh.object_id}
 			${if_table:scg,s:inner join ${TABLE_PREFIX}service_contactgroups AS scg on scg.service_id = s.service_id}
@@ -311,7 +311,7 @@ class IcingaApiSearchIdoPgsql
 				${FIELDS}
 			from
 				${TABLE_PREFIX}hostgroups AS hg
-			${if_table:i,hg:inner join ${TABLE_PREFIX}instances AS i on i.instance_id = hg.instance_id}
+			inner join ${TABLE_PREFIX}instances AS i on i.instance_id = hg.instance_id
 			${if_table:ohg:inner join ${TABLE_PREFIX}objects AS ohg on ohg.object_id = hg.hostgroup_object_id and ohg.is_active = 1}
 			${if_table:hgm:inner join ${TABLE_PREFIX}hostgroup_members AS hgm on hgm.hostgroup_id = hg.hostgroup_id}
 			${if_table:oh,hgm:inner join ${TABLE_PREFIX}objects AS oh on oh.object_id = hgm.host_object_id}
@@ -325,7 +325,7 @@ class IcingaApiSearchIdoPgsql
 				${FIELDS}
 			from
 			${TABLE_PREFIX}servicegroups AS sg
-			${if_table:i,sg:inner join ${TABLE_PREFIX}instances AS i on i.instance_id = sg.instance_id}
+			inner join ${TABLE_PREFIX}instances AS i on i.instance_id = sg.instance_id
 			${if_table:osg:inner join ${TABLE_PREFIX}objects AS osg on osg.object_id = sg.servicegroup_object_id and osg.is_active = 1}
 			${if_table:sgm:inner join ${TABLE_PREFIX}servicegroup_members AS sgm on sgm.servicegroup_id = sg.servicegroup_id}
 			${if_table:os,sgm:inner join ${TABLE_PREFIX}objects AS os on os.object_id = sgm.service_object_id}
@@ -354,7 +354,7 @@ class IcingaApiSearchIdoPgsql
 			left join ${TABLE_PREFIX}hoststatus AS hs on hs.host_object_id = oh.object_id
 			left join ${TABLE_PREFIX}services AS s on s.service_object_id = os.object_id
 			left join ${TABLE_PREFIX}servicestatus AS ss on ss.service_object_id = os.object_id
-			${if_table:i,h:inner join ${TABLE_PREFIX}instances AS i on i.instance_id = h.instance_id}
+			left join ${TABLE_PREFIX}instances AS i on i.instance_id = h.instance_id
 			${if_table:hcg,h:inner join ${TABLE_PREFIX}host_contactgroups AS hcg on hcg.host_id = h.host_id}
 			${if_table:cg,h:inner join ${TABLE_PREFIX}contactgroups AS cg on cg.contactgroup_object_id = hcg.contactgroup_object_id}
 			${if_table:ocg,hcg,h:inner join ${TABLE_PREFIX}objects AS ocg on ocg.object_id = hcg.contactgroup_object_id and ocg.objecttype_id = 11}
@@ -386,7 +386,7 @@ class IcingaApiSearchIdoPgsql
 			inner join ${TABLE_PREFIX}objects AS oh on (oh.object_id = op.object_id and op.objecttype_id = 1) OR oh.object_id = s.host_object_id
 			inner join ${TABLE_PREFIX}hosts AS h on h.host_object_id = oh.object_id
 
-			${if_table:i,h:left join ${TABLE_PREFIX}instances AS i on i.instance_id = h.instance_id}
+			left join ${TABLE_PREFIX}instances AS i on i.instance_id = h.instance_id
 
 			${if_table:hgm:left join ${TABLE_PREFIX}hostgroup_members AS hgm on hgm.host_object_id = oh.object_id}
 





More information about the icinga-checkins mailing list