[icinga-checkins] icinga.org: icinga-core/mfriedrich/ido: idoutils: fix sla_downtime_select query and result handle; scheduled downtime merge statement #2780

git at icinga.org git at icinga.org
Fri Aug 31 17:55:16 CEST 2012


Module: icinga-core
Branch: mfriedrich/ido
Commit: da7e1692ed32faae7ff5b5254edf4a13698143dc
URL:    https://git.icinga.org/?p=icinga-core.git;a=commit;h=da7e1692ed32faae7ff5b5254edf4a13698143dc

Author: Michael Friedrich <michael.friedrich at gmail.com>
Date:   Fri Aug 31 17:54:00 2012 +0200

idoutils: fix sla_downtime_select query and result handle; scheduled downtime merge statement #2780

refs #2780

---

 Changelog                 |    1 +
 module/idoutils/src/db.c  |   10 +++++-----
 module/idoutils/src/sla.c |    2 +-
 3 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/Changelog b/Changelog
index 3440c11..5b39cf8 100644
--- a/Changelog
+++ b/Changelog
@@ -80,6 +80,7 @@ FIXES
 
 * idoutils: set result handle explicitely to NULL after dbi_result_free() to prevent memory free'ing corruption #2612 - MF/GB
 * idoutils: fix ignoring mysql password in create_mysqldb.sh #2994 - MF
+* idoutils: fix sla_downtime_select query and result handle; scheduled downtime merge statement #2780 - MF
 
 CHANGES
 
diff --git a/module/idoutils/src/db.c b/module/idoutils/src/db.c
index a346fdf..6d6a49e 100644
--- a/module/idoutils/src/db.c
+++ b/module/idoutils/src/db.c
@@ -5076,7 +5076,7 @@ int ido2db_oci_prepared_statement_downtimedata_scheduled_downtime(ido2db_idi *id
 	             "INSERT (id, instance_id, downtime_type, object_id, "
 	             "entry_time, author_name, comment_data, "
 	             "internal_downtime_id, triggered_by_id, "
-	             "is_fixed, duration, scheduled_start_time, scheduled_end_time "
+	             "is_fixed, duration, scheduled_start_time, scheduled_end_time, "
 		     "is_in_effect, trigger_time) "
 	             "VALUES (seq_scheduleddowntime.nextval, :X1, :X2, :X3, "
 	             "unixts2localts(:X4), :X5, :X6, "
@@ -7357,11 +7357,11 @@ int ido2db_oci_prepared_statement_sla_downtime_select(ido2db_idi *idi) {
 		     "is_fixed, duration "
 		     "FROM %s "
 		     "WHERE instance_id = :X1 AND object_id = :X2 AND "
-		     "((actual_start_time > :X3 AND actual_start_time < :X4) OR "
-		     " (actual_end_time > :X3 AND actual_end_time < :X4) OR "
-		     " (actual_start_time < :X3 AND actual_end_time > :X4) OR "
+		     "((actual_start_time > unixts2localts(:X3) AND actual_start_time < unixts2localts(:X4)) OR "
+		     " (actual_end_time > unixts2localts(:X3) AND actual_end_time < unixts2localts(:X4)) OR "
+		     " (actual_start_time < unixts2localts(:X3) AND actual_end_time > unixts2localts(:X4)) OR "
 		     " (actual_end_time = unixts2localts(0)))",
-	             ido2db_db_tablenames[IDO2DB_DBTABLE_SLAHISTORY]) == -1) {
+	             ido2db_db_tablenames[IDO2DB_DBTABLE_DOWNTIMEHISTORY]) == -1) {
 		buf = NULL;
 	}
 
diff --git a/module/idoutils/src/sla.c b/module/idoutils/src/sla.c
index 6968445..75cd18c 100644
--- a/module/idoutils/src/sla.c
+++ b/module/idoutils/src/sla.c
@@ -869,7 +869,7 @@ int sla_query_downtime(ido2db_idi *idi, unsigned long object_id,
 	OCI_Commit(idi->dbinfo.oci_connection);
 
 	idi->dbinfo.oci_resultset = OCI_GetResultset(
-	                                idi->dbinfo.oci_statement_sla_services_select);
+	                                idi->dbinfo.oci_statement_sla_downtime_select);
 
 	ido2db_log_debug_info(IDO2DB_DEBUGL_PROCESSINFO, 2,
 	                      "sla_query_downtime() query ok\n");





More information about the icinga-checkins mailing list