[svn-commits] tilghman: branch 1.6.0 r1070 - /branches/1.6.0/res/res_config_mysql.c

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


Author: tilghman
Date: Fri Dec  4 10:11:17 2009
New Revision: 1070

URL: http://svnview.digium.com/svn/asterisk-addons?view=rev&rev=1070
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.0/res/res_config_mysql.c

Modified: branches/1.6.0/res/res_config_mysql.c
URL: http://svnview.digium.com/svn/asterisk-addons/branches/1.6.0/res/res_config_mysql.c?view=diff&rev=1070&r1=1069&r2=1070
==============================================================================
--- branches/1.6.0/res/res_config_mysql.c (original)
+++ branches/1.6.0/res/res_config_mysql.c Fri Dec  4 10:11:17 2009
@@ -169,18 +169,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