[icinga-checkins] icinga.org: icinga-core/mfriedrich/ido: idoutils: fix doubled quotes by skipping escaping data (Oracle only) #2534

git at icinga.org git at icinga.org
Thu Jun 21 11:06:53 CEST 2012


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

Author: Thomas Dressler <tdressler at tdressler.net>
Date:   Fri Apr 27 21:24:15 2012 +0200

idoutils: fix doubled quotes by skipping escaping data (Oracle only) #2534

edit by Michael Friedrich <michael.friedrich at univie.ac.at>

- corrected tabs
- corrected debug output, we also want to know when oracle enters this
  function, even if useless what the copy was
- corrected changelog for 1.8 target

refs #2534

Conflicts:

	Changelog
	module/idoutils/src/db.c

---

 Changelog                |    1 +
 module/idoutils/src/db.c |   20 +++++++++-----------
 2 files changed, 10 insertions(+), 11 deletions(-)

diff --git a/Changelog b/Changelog
index 32b1cb7..3ac8a83 100644
--- a/Changelog
+++ b/Changelog
@@ -13,6 +13,7 @@ ENHANCEMENTS
 FIXES
 * idoutils: do not pass host and port if not set in the config, letting mysql|pgsql drivers autoselect the socket #2698 - MF
 * idoutils: fix mismatched types for uint casts in bulkops (oracle) #2646 - TD
+* idoutils: fix doubled quotes by skipping escaping data (Oracle only) #2534 - TD
 
 CHANGES
 * core: neb struct statechange data += long_ouput #2650 - MF
diff --git a/module/idoutils/src/db.c b/module/idoutils/src/db.c
index fa18f34..c2c2bc6 100644
--- a/module/idoutils/src/db.c
+++ b/module/idoutils/src/db.c
@@ -2381,6 +2381,15 @@ char *ido2db_db_escape_string(ido2db_idi *idi, char *buf) {
 		return NULL;
 	}
 
+#ifdef USE_ORACLE
+	/* oracle doesnt need escaping because of bind variables,
+	 * but we need to allocate the buffer #2534
+	 * */
+	strcpy(newbuf,buf);
+	ido2db_log_debug_info(IDO2DB_DEBUGL_PROCESSINFO, 2, "ido2db_db_escape_string oracle changed string ('%s')\n", newbuf);
+	return newbuf;
+#endif
+
 
 	/* escape characters */
 #ifdef USE_LIBDBI /* everything else will be libdbi */
@@ -2427,17 +2436,6 @@ char *ido2db_db_escape_string(ido2db_idi *idi, char *buf) {
 
 #endif
 
-#ifdef USE_ORACLE /* Oracle ocilib specific */
-
-	for (x = 0, y = 0; x < z; x++) {
-
-		if (buf[x] == '\'')
-			newbuf[y++] = '\'';
-
-		newbuf[y++] = buf[x];
-	}
-#endif /* Oracle ocilib specific */
-
 	/* terminate escape string */
 	newbuf[y] = '\0';
 	if (strcmp(buf, newbuf) != 0) {





More information about the icinga-checkins mailing list