Merge "res_config_odbc: set empty extended field as a single whitespace" into 13

13.26
Friendly Automation 7 years ago committed by Gerrit Code Review
commit e821071943

@ -289,6 +289,20 @@ static struct ast_variable *realtime_odbc(const char *database, const char *tabl
}
stringp = ast_str_buffer(rowdata);
if (!strncmp(coltitle, "@", 1)) {
/* The '@' prefix indicates it's a sorcery extended field.
* Because ast_load_realtime_fields eliminates empty entries and makes blank (single whitespace)
* entries empty and keeps them, the empty or NULL values are encoded
* as a string containing a single whitespace. */
if (prev) {
prev->next = ast_variable_new(coltitle, S_OR(stringp," "), "");
if (prev->next) {
prev = prev->next;
}
} else {
prev = var = ast_variable_new(coltitle, S_OR(stringp," "), "");
}
} else {
while (stringp) {
chunk = strsep(&stringp, ";");
if (!ast_strlen_zero(ast_strip(chunk))) {
@ -306,6 +320,7 @@ static struct ast_variable *realtime_odbc(const char *database, const char *tabl
}
}
}
}
SQLFreeHandle(SQL_HANDLE_STMT, stmt);
ast_odbc_release_obj(obj);
@ -453,6 +468,14 @@ static struct ast_config *realtime_multi_odbc(const char *database, const char *
goto next_sql_fetch;
}
stringp = ast_str_buffer(rowdata);
if (!strncmp(coltitle, "@", 1)) {
/* The '@' prefix indicates it's a sorcery extended field.
* Because ast_load_realtime_fields eliminates empty entries and makes blank (single whitespace)
* entries empty and keeps them, the empty or NULL values are encoded
* as a string containing a single whitespace. */
var = ast_variable_new(coltitle, S_OR(stringp," "), "");
ast_variable_append(cat, var);
} else {
while (stringp) {
chunk = strsep(&stringp, ";");
if (!ast_strlen_zero(ast_strip(chunk))) {
@ -467,6 +490,7 @@ static struct ast_config *realtime_multi_odbc(const char *database, const char *
}
}
}
}
ast_category_append(cfg, cat);
next_sql_fetch:;
}

Loading…
Cancel
Save