[svn-commits] tilghman: branch 1.6.2 r1072 - /branches/1.6.2/res/res_config_mysql.c

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


Author: tilghman
Date: Fri Dec  4 10:14:31 2009
New Revision: 1072

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

Modified: branches/1.6.2/res/res_config_mysql.c
URL: http://svnview.digium.com/svn/asterisk-addons/branches/1.6.2/res/res_config_mysql.c?view=diff&rev=1072&r1=1071&r2=1072
==============================================================================
--- branches/1.6.2/res/res_config_mysql.c (original)
+++ branches/1.6.2/res/res_config_mysql.c Fri Dec  4 10:14:31 2009
@@ -383,12 +383,13 @@
 
 		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))) {
-						continue;
-					}
 					if (prev) {
 						if ((prev->next = ast_variable_new(fields[i].name, chunk, ""))) {
 							prev = prev->next;




More information about the svn-commits mailing list