aboutsummaryrefslogtreecommitdiffstats
path: root/res/res_config_odbc.c
diff options
context:
space:
mode:
authortilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b>2007-01-07 16:21:12 +0000
committertilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b>2007-01-07 16:21:12 +0000
commitb218a25733127773940a60371c9eb685a47f9236 (patch)
tree7a7b6db348f112659b0159872ae3b3aa727df3ea /res/res_config_odbc.c
parentd78e74ce7e376b55771b8933afd24f7cedfd2bd3 (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/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);
}
}