[asterisk-commits] tilghman: trunk r233050 - /trunk/addons/res_config_mysql.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Dec 4 10:09:01 CST 2009


Author: tilghman
Date: Fri Dec  4 10:08:58 2009
New Revision: 233050

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=233050
Log:
Update the mysql driver to always return NULL columns, as this is needed for the realtime API to work correctly.

Modified:
    trunk/addons/res_config_mysql.c

Modified: trunk/addons/res_config_mysql.c
URL: http://svnview.digium.com/svn/asterisk/trunk/addons/res_config_mysql.c?view=diff&rev=233050&r1=233049&r2=233050
==============================================================================
--- trunk/addons/res_config_mysql.c (original)
+++ trunk/addons/res_config_mysql.c Fri Dec  4 10:08:58 2009
@@ -367,12 +367,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 asterisk-commits mailing list