[icinga-checkins] icinga.org: icinga-core/master: fix for oracle when binding a NULL value on contactnotificationmethods

git at icinga.org git at icinga.org
Tue May 11 18:36:05 CEST 2010


Module: icinga-core
Branch: master
Commit: 3664dc6978fef938df725a29252c6b037ca5df6f
URL:    https://git.icinga.org/?p=icinga-core.git;a=commit;h=3664dc6978fef938df725a29252c6b037ca5df6f

Author: Michael Friedrich <michael.friedrich at univie.ac.at>
Date:   Tue May 11 14:25:05 2010 +0200

fix for oracle when binding a NULL value on contactnotificationmethods

---

 Changelog                       |    1 +
 module/idoutils/src/dbqueries.c |   11 ++++++++---
 2 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/Changelog b/Changelog
index 5292633..2f5c604 100644
--- a/Changelog
+++ b/Changelog
@@ -23,6 +23,7 @@ FIXES
 * idoutils: ndo2db_get_object_id fails to return existing IDs (William Preston)
 * idoutils: fix postgres wrong type in service_object_id
 * idoutils: modify string escaping again (mysql, pgsql), needs a full rewrite though
+* idoutils: fix for oracle when binding a NULL value on contactnotificationmethods
 
 
 1.0.1 - 03/03/2010
diff --git a/module/idoutils/src/dbqueries.c b/module/idoutils/src/dbqueries.c
index b08cbf5..c5b93a0 100644
--- a/module/idoutils/src/dbqueries.c
+++ b/module/idoutils/src/dbqueries.c
@@ -1199,6 +1199,9 @@ int ido2db_query_insert_or_update_contactnotificationmethoddata_add(ndo2db_idi *
                         break;
         }
 #else /* Oracle ocilib specific */
+
+			ndo2db_log_debug_info(NDO2DB_DEBUGL_PROCESSINFO, 2, "ido2db_query_contactnotificationmethoddata() %lu, %lu, %lu, %lu, %lu, %lu, %lu, %s \n", *(unsigned long *) data[0], *(unsigned long *) data[1], *(unsigned long *) data[8], *(unsigned long *) data[3], *(unsigned long *) data[9], *(unsigned long *) data[5], *(unsigned long *) data[6], *(char **) data[7]);
+
                         if(!OCI_BindUnsignedBigInt(idi->dbinfo.oci_statement_contactnotificationmethoddata, MT(":X1"), (big_uint *) data[0])) {
                                 return NDO_ERROR;
                         }
@@ -1220,9 +1223,11 @@ int ido2db_query_insert_or_update_contactnotificationmethoddata_add(ndo2db_idi *
                         if(!OCI_BindUnsignedBigInt(idi->dbinfo.oci_statement_contactnotificationmethoddata, MT(":X7"), (big_uint *) data[6])) {
                                 return NDO_ERROR;
                         }
-                        if(!OCI_BindString(idi->dbinfo.oci_statement_contactnotificationmethoddata, MT(":X8"), *(char **) data[7], 0)) {
-                                return NDO_ERROR;
-                        }
+                        if(*(char **) data[7] != NULL) {
+				if(!OCI_BindString(idi->dbinfo.oci_statement_contactnotificationmethoddata, MT(":X8"), *(char **) data[7], 0)) {
+        	                        return NDO_ERROR;
+	                        }
+			}
 
                         /* execute statement */
                         if(!OCI_Execute(idi->dbinfo.oci_statement_contactnotificationmethoddata)) {





More information about the icinga-checkins mailing list