diff options
author | tilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b> | 2009-12-04 16:08:58 +0000 |
---|---|---|
committer | tilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b> | 2009-12-04 16:08:58 +0000 |
commit | 08651f52a3d83fead3f3203f79647ac288e9a7cd (patch) | |
tree | 22b74d158f445168c9e0165a9ff8fe43f94434f9 /addons | |
parent | 7a9301cf8f777da14c00ecd83a03b59c6d01bedf (diff) |
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
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@233050 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'addons')
-rw-r--r-- | addons/res_config_mysql.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/addons/res_config_mysql.c b/addons/res_config_mysql.c index 273114cbe..c68c29d9b 100644 --- a/addons/res_config_mysql.c +++ b/addons/res_config_mysql.c @@ -367,12 +367,13 @@ static struct ast_variable *realtime_mysql(const char *database, const char *tab 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; |