[svn-commits] tilghman: branch 1.6.1 r1071 - /branches/1.6.1/res/res_config_mysql.c

SVN commits to the Digium repositories svn-commits at lists.digium.com
Fri Dec 4 10:12:28 CST 2009


Author: tilghman
Date: Fri Dec  4 10:12:24 2009
New Revision: 1071

URL: http://svnview.digium.com/svn/asterisk-addons?view=rev&rev=1071
Log:
Update the mysql driver to always return NULL columns, as this is needed for the realtime API to work correctly.
(closes issue #16138)
 Reported by: sohosys
 Patches:
       20091029__issue16138.diff.txt uploaded by tilghman (license 14)
 Tested by: sohosys

Modified:
    branches/1.6.1/res/res_config_mysql.c

Modified: branches/1.6.1/res/res_config_mysql.c
URL: http://svnview.digium.com/svn/asterisk-addons/branches/1.6.1/res/res_config_mysql.c?view=diff&rev=1071&r1=1070&r2=1071
==============================================================================
--- branches/1.6.1/res/res_config_mysql.c (original)
+++ branches/1.6.1/res/res_config_mysql.c Fri Dec  4 10:12:24 2009
@@ -377,18 +377,20 @@
 
 		while ((row = mysql_fetch_row(result))) {
 			for (i = 0; i < numFields; i++) {
-				if (ast_strlen_zero(row[i]))
-					continue;
+				/* Encode NULL values separately from blank values, for the Realtime API */
+				if (row[i] == NULL) {
+					row[i] = "";
+				} else if (ast_strlen_zero(row[i])) {
+					row[i] = " ";
+				}
 				for (stringp = ast_strdupa(row[i]), chunk = strsep(&stringp, ";"); chunk; chunk = strsep(&stringp, ";")) {
-					if (chunk && !ast_strlen_zero(ast_strip(chunk))) {
-						if (prev) {
-							prev->next = ast_variable_new(fields[i].name, chunk, "");
-							if (prev->next) {
-								prev = prev->next;
-							}
-						} else {
-							prev = var = ast_variable_new(fields[i].name, chunk, "");
+					if (prev) {
+						prev->next = ast_variable_new(fields[i].name, chunk, "");
+						if (prev->next) {
+							prev = prev->next;
 						}
+					} else {
+						prev = var = ast_variable_new(fields[i].name, chunk, "");
 					}
 				}
 			}




More information about the svn-commits mailing list