summaryrefslogtreecommitdiff
path: root/res/res_config_odbc.c
diff options
context:
space:
mode:
authorTilghman Lesher <tilghman@meg.abyt.es>2007-01-07 16:21:12 +0000
committerTilghman Lesher <tilghman@meg.abyt.es>2007-01-07 16:21:12 +0000
commitc4c2c546da7546a3ebd349cfd61e5ec27a3e2e12 (patch)
tree7a7b6db348f112659b0159872ae3b3aa727df3ea /res/res_config_odbc.c
parent785483f3040f47d2fd34e9904f04d6408470d083 (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: https://origsvn.digium.com/svn/asterisk/trunk@49801 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'res/res_config_odbc.c')
-rw-r--r--res/res_config_odbc.c22
1 files changed, 12 insertions, 10 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);
}
}