Title: [opsview] [11310] Fix filtering of dependencies, which broke when adding the ORDER BY clause
Revision
11310
Author
tvoon
Date
2013-02-01 10:30:06 +0000 (Fri, 01 Feb 2013)

Log Message

Fix filtering of dependencies, which broke when adding the ORDER BY clause

Modified Paths

Modified: trunk/opsview-core/lib/Opsview/Servicecheck.pm
===================================================================
--- trunk/opsview-core/lib/Opsview/Servicecheck.pm	2013-02-01 09:37:37 UTC (rev 11309)
+++ trunk/opsview-core/lib/Opsview/Servicecheck.pm	2013-02-01 10:30:06 UTC (rev 11310)
@@ -572,7 +572,6 @@
 
     $dbh->do( "DROP TEMPORARY TABLE temp_host_services_staging" );
 
-    # The ORDER BY clause is for testing, but it is pretty fast so can leave it in
     my $sql = <<"";
 SELECT
 h.name as host_name, servicechecks.name as dependency_name, hs2.attribute as servicecheck_attribute, hs2.servicecheckname as servicecheck_name
@@ -589,19 +588,19 @@
 and h.id = hs2.hostid
 and scdep.dependencyid = servicechecks.id
 and servicechecks.attribute IS NULL
-ORDER BY hs2.servicecheckid, hs2.hostid
 
     my $sth;
-    if ( $ms->is_master ) {
-        $sth = $dbh->prepare_cached($sql);
-        $sth->execute;
-    }
-    else {
+    my @bind;
+    unless ( $ms->is_master ) {
         $sql .= " and h.monitored_by = ?";
-        $sth = $dbh->prepare_cached($sql);
-        $sth->execute( $ms->id );
+        push @bind, $ms->id;
     }
 
+    # The ORDER BY clause is for testing, but it is pretty fast so can leave it in
+    $sql .= " ORDER BY hs2.servicecheckid, hs2.hostid";
+    $sth = $dbh->prepare_cached($sql);
+    $sth->execute(@bind);
+
     my @results;
     while ( my $row = $sth->fetchrow_hashref ) {
         my $h = {};

_______________________________________________
Opsview-checkins mailing list
[email protected]
http://lists.opsview.org/lists/listinfo/opsview-checkins

Reply via email to