[icinga-checkins] icinga.org: icinga-core/fix/socketqueue-4049: Remove unused parameters for ido2db_set_object_as_active().

git at icinga.org git at icinga.org
Tue May 7 09:20:19 CEST 2013


Module: icinga-core
Branch: fix/socketqueue-4049
Commit: c4b6f3fe8fdf2442456c0655e6a53d6e055b1d07
URL:    https://git.icinga.org/?p=icinga-core.git;a=commit;h=c4b6f3fe8fdf2442456c0655e6a53d6e055b1d07

Author: Gunnar Beutner <gunnar.beutner at netways.de>
Date:   Tue Apr 30 14:14:39 2013 +0200

Remove unused parameters for ido2db_set_object_as_active().

---

 module/idoutils/include/dbhandlers.h |    2 +-
 module/idoutils/src/db.c             |    2 +-
 module/idoutils/src/dbhandlers.c     |   30 +++++++++++-------------------
 3 files changed, 13 insertions(+), 21 deletions(-)

diff --git a/module/idoutils/include/dbhandlers.h b/module/idoutils/include/dbhandlers.h
index f6c3fd3..9960323 100644
--- a/module/idoutils/include/dbhandlers.h
+++ b/module/idoutils/include/dbhandlers.h
@@ -25,7 +25,7 @@ int ido2db_object_hashfunc(const char *,const char *,int);
 int ido2db_compare_object_hashdata(const char *,const char *,const char *,const char *);
 
 int ido2db_set_all_objects_as_inactive(ido2db_idi *);
-int ido2db_set_object_as_active(ido2db_idi *,int,unsigned long);
+int ido2db_set_object_as_active(ido2db_idi *,unsigned long);
 
 int ido2db_handle_logentry(ido2db_idi *);
 int ido2db_handle_processdata(ido2db_idi *);
diff --git a/module/idoutils/src/db.c b/module/idoutils/src/db.c
index 5e20922..b67b3bf 100644
--- a/module/idoutils/src/db.c
+++ b/module/idoutils/src/db.c
@@ -3583,7 +3583,7 @@ int ido2db_oci_prepared_statement_objects_update_active(ido2db_idi *idi) {
 	//ido2db_log_debug_info(IDO2DB_DEBUGL_PROCESSINFO, 2, "ido2db_oci_prepared_statement_() start\n");
 
 	if (asprintf(&buf, "UPDATE %s SET is_active=1 "
-	             "WHERE instance_id=:X2 AND objecttype_id=:X3 AND id=:X4",
+	             "WHERE id=:X2",
 	             ido2db_db_tablenames[IDO2DB_DBTABLE_OBJECTS]) == -1) {
 		buf = NULL;
 	}
diff --git a/module/idoutils/src/dbhandlers.c b/module/idoutils/src/dbhandlers.c
index 976df6d..65e35df 100644
--- a/module/idoutils/src/dbhandlers.c
+++ b/module/idoutils/src/dbhandlers.c
@@ -878,8 +878,8 @@ int ido2db_set_all_objects_as_inactive(ido2db_idi *idi) {
 	return result;
 }
 
-int ido2db_set_object_as_active(ido2db_idi *idi, int object_type,
-                                unsigned long object_id) {
+
+int ido2db_set_object_as_active(ido2db_idi *idi, unsigned long object_id) {
 	int result = IDO_OK;
 #ifdef USE_LIBDBI
 	char *buf = NULL;
@@ -919,20 +919,12 @@ int ido2db_set_object_as_active(ido2db_idi *idi, int object_type,
 		return IDO_ERROR;
 
 
-	data[0] = (void *) &idi->dbinfo.instance_id;
-	data[1] = (void *) &object_type;
-	data[2] = (void *) &object_id;
+	data[0] = (void *) &object_id;
 
 
 	if (!OCI_BindUnsignedInt(idi->dbinfo.oci_statement_objects_update_active, MT(":X2"), (uint *) data[0])) {
 		return IDO_ERROR;
 	}
-	if (!OCI_BindInt(idi->dbinfo.oci_statement_objects_update_active, MT(":X3"), (int *) data[1])) {
-		return IDO_ERROR;
-	}
-	if (!OCI_BindUnsignedInt(idi->dbinfo.oci_statement_objects_update_active, MT(":X4"), (uint *) data[2])) {
-		return IDO_ERROR;
-	}
 
 	/* execute statement */
 	if (!OCI_Execute(idi->dbinfo.oci_statement_objects_update_active)) {
@@ -5548,7 +5540,7 @@ int ido2db_handle_hostdefinition(ido2db_idi *idi) {
 	result = ido2db_get_object_id_with_insert(idi, IDO2DB_OBJECTTYPE_HOST, idi->buffered_input[IDO_DATA_HOSTNAME], NULL, &object_id);
 
 	/* flag the object as being active */
-	ido2db_set_object_as_active(idi, IDO2DB_OBJECTTYPE_HOST, object_id);
+	ido2db_set_object_as_active(idi, object_id);
 
 	/* get the timeperiod ids */
 	result = ido2db_get_object_id_with_insert(idi, IDO2DB_OBJECTTYPE_TIMEPERIOD, idi->buffered_input[IDO_DATA_HOSTCHECKPERIOD], NULL, &check_timeperiod_id);
@@ -6082,7 +6074,7 @@ int ido2db_handle_hostgroupdefinition(ido2db_idi *idi) {
 	result = ido2db_get_object_id_with_insert(idi, IDO2DB_OBJECTTYPE_HOSTGROUP, idi->buffered_input[IDO_DATA_HOSTGROUPNAME], NULL, &object_id);
 
 	/* flag the object as being active */
-	ido2db_set_object_as_active(idi, IDO2DB_OBJECTTYPE_HOSTGROUP, object_id);
+	ido2db_set_object_as_active(idi, object_id);
 
 	/* add definition to db */
 	data[0] = (void *) &idi->dbinfo.instance_id;
@@ -6390,7 +6382,7 @@ int ido2db_handle_servicedefinition(ido2db_idi *idi) {
 	result = ido2db_get_object_id_with_insert(idi, IDO2DB_OBJECTTYPE_HOST, idi->buffered_input[IDO_DATA_HOSTNAME], NULL, &host_id);
 
 	/* flag the object as being active */
-	ido2db_set_object_as_active(idi, IDO2DB_OBJECTTYPE_SERVICE, object_id);
+	ido2db_set_object_as_active(idi, object_id);
 
 	/* get the timeperiod ids */
 	result = ido2db_get_object_id_with_insert(idi, IDO2DB_OBJECTTYPE_TIMEPERIOD, idi->buffered_input[IDO_DATA_SERVICECHECKPERIOD], NULL, &check_timeperiod_id);
@@ -6793,7 +6785,7 @@ int ido2db_handle_servicegroupdefinition(ido2db_idi *idi) {
 	result = ido2db_get_object_id_with_insert(idi, IDO2DB_OBJECTTYPE_SERVICEGROUP, idi->buffered_input[IDO_DATA_SERVICEGROUPNAME], NULL, &object_id);
 
 	/* flag the object as being active */
-	ido2db_set_object_as_active(idi, IDO2DB_OBJECTTYPE_SERVICEGROUP, object_id);
+	ido2db_set_object_as_active(idi, object_id);
 
 	/* add definition to db */
 	data[0] = (void *) &idi->dbinfo.instance_id;
@@ -7319,7 +7311,7 @@ int ido2db_handle_commanddefinition(ido2db_idi *idi) {
 	result = ido2db_get_object_id_with_insert(idi, IDO2DB_OBJECTTYPE_COMMAND, idi->buffered_input[IDO_DATA_COMMANDNAME], NULL, &object_id);
 
 	/* flag the object as being active */
-	ido2db_set_object_as_active(idi, IDO2DB_OBJECTTYPE_COMMAND, object_id);
+	ido2db_set_object_as_active(idi, object_id);
 
 	/* add definition to db */
 	data[0] = (void *) &idi->dbinfo.instance_id;
@@ -7386,7 +7378,7 @@ int ido2db_handle_timeperiodefinition(ido2db_idi *idi) {
 	result = ido2db_get_object_id_with_insert(idi, IDO2DB_OBJECTTYPE_TIMEPERIOD, idi->buffered_input[IDO_DATA_TIMEPERIODNAME], NULL, &object_id);
 
 	/* flag the object as being active */
-	ido2db_set_object_as_active(idi, IDO2DB_OBJECTTYPE_TIMEPERIOD, object_id);
+	ido2db_set_object_as_active(idi, object_id);
 
 	/* add definition to db */
 	data[0] = (void *) &idi->dbinfo.instance_id;
@@ -7650,7 +7642,7 @@ int ido2db_handle_contactdefinition(ido2db_idi *idi) {
 	         &service_timeperiod_id);
 
 	/* flag the object as being active */
-	ido2db_set_object_as_active(idi, IDO2DB_OBJECTTYPE_CONTACT, contact_id);
+	ido2db_set_object_as_active(idi, contact_id);
 
 	/* add definition to db */
 	data[0] = (void *) &idi->dbinfo.instance_id;
@@ -7901,7 +7893,7 @@ int ido2db_handle_contactgroupdefinition(ido2db_idi *idi) {
 	result = ido2db_get_object_id_with_insert(idi, IDO2DB_OBJECTTYPE_CONTACTGROUP, idi->buffered_input[IDO_DATA_CONTACTGROUPNAME], NULL, &object_id);
 
 	/* flag the object as being active */
-	ido2db_set_object_as_active(idi, IDO2DB_OBJECTTYPE_CONTACTGROUP, object_id);
+	ido2db_set_object_as_active(idi, object_id);
 
 	/* add definition to db */
 	data[0] = (void *) &idi->dbinfo.instance_id;





More information about the icinga-checkins mailing list