diff options
author | tilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b> | 2007-01-07 16:21:12 +0000 |
---|---|---|
committer | tilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b> | 2007-01-07 16:21:12 +0000 |
commit | b218a25733127773940a60371c9eb685a47f9236 (patch) | |
tree | 7a7b6db348f112659b0159872ae3b3aa727df3ea /res | |
parent | d78e74ce7e376b55771b8933afd24f7cedfd2bd3 (diff) |
When calling the Realtime app more than once, unset fields which were
previously set are erroneously still set (Bug 6701). After discussion,
it was determined this should only be changed in trunk.
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@49801 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'res')
-rw-r--r-- | res/res_config_odbc.c | 22 | ||||
-rw-r--r-- | res/res_realtime.c | 2 |
2 files changed, 13 insertions, 11 deletions
diff --git a/res/res_config_odbc.c b/res/res_config_odbc.c index 3ef3edd33..5c725a0e1 100644 --- a/res/res_config_odbc.c +++ b/res/res_config_odbc.c @@ -168,7 +168,12 @@ static struct ast_variable *realtime_odbc(const char *database, const char *tabl indicator = 0; res = SQLGetData(stmt, x + 1, SQL_CHAR, rowdata, sizeof(rowdata), &indicator); if (indicator == SQL_NULL_DATA) - continue; + rowdata[0] = '\0'; + else if (ast_strlen_zero(rowdata)) { + /* Because we encode the empty string for a NULL, we will encode + * actual empty strings as a string containing a single whitespace. */ + ast_copy_string(rowdata, " ", sizeof(rowdata)); + } if ((res != SQL_SUCCESS) && (res != SQL_SUCCESS_WITH_INFO)) { ast_log(LOG_WARNING, "SQL Get Data error!\n[%s]\n\n", sql); @@ -180,15 +185,12 @@ static struct ast_variable *realtime_odbc(const char *database, const char *tabl stringp = rowdata; while(stringp) { chunk = strsep(&stringp, ";"); - if (!ast_strlen_zero(ast_strip(chunk))) { - if (prev) { - prev->next = ast_variable_new(coltitle, chunk); - if (prev->next) - prev = prev->next; - } else - prev = var = ast_variable_new(coltitle, chunk); - - } + if (prev) { + prev->next = ast_variable_new(coltitle, chunk); + if (prev->next) + prev = prev->next; + } else + prev = var = ast_variable_new(coltitle, chunk); } } diff --git a/res/res_realtime.c b/res/res_realtime.c index 1a750d9cf..28525f448 100644 --- a/res/res_realtime.c +++ b/res/res_realtime.c @@ -57,7 +57,7 @@ static int cli_realtime_load(int fd, int argc, char **argv) return RESULT_FAILURE; } - var = ast_load_realtime(argv[2], argv[3], argv[4], NULL); + var = ast_load_realtime_all(argv[2], argv[3], argv[4], NULL); if(var) { ast_cli(fd, header_format, "Column Name", "Column Value"); |