aboutsummaryrefslogtreecommitdiffstats
path: root/res/res_config_odbc.c
diff options
context:
space:
mode:
authorkpfleming <kpfleming@f38db490-d61c-443f-a65b-d21fe96a405b>2005-04-22 01:59:53 +0000
committerkpfleming <kpfleming@f38db490-d61c-443f-a65b-d21fe96a405b>2005-04-22 01:59:53 +0000
commit609a841788684da7857674deed3580d72f5a17e8 (patch)
treee34253b5e14876fb3817f7d46d0fd04611c0eb80 /res/res_config_odbc.c
parent680a9198c73d177c658374122bb80854fd66f639 (diff)
ensure that res_config_odbc can handle columns with NULL values (bug #3787)
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@5493 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'res/res_config_odbc.c')
-rwxr-xr-xres/res_config_odbc.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/res/res_config_odbc.c b/res/res_config_odbc.c
index 4a1080a3c..cc31016d7 100755
--- a/res/res_config_odbc.c
+++ b/res/res_config_odbc.c
@@ -49,6 +49,7 @@ static struct ast_variable *realtime_odbc(const char *database, const char *tabl
SQLSMALLINT datatype;
SQLSMALLINT decimaldigits;
SQLSMALLINT nullable;
+ SQLINTEGER indicator;
va_list aq;
va_copy(aq, ap);
@@ -136,7 +137,12 @@ static struct ast_variable *realtime_odbc(const char *database, const char *tabl
ast_variables_destroy(var);
return NULL;
}
- res = SQLGetData(stmt, x + 1, SQL_CHAR, rowdata, sizeof(rowdata), NULL);
+
+ indicator = 0;
+ res = SQLGetData(stmt, x + 1, SQL_CHAR, rowdata, sizeof(rowdata), &indicator);
+ if (indicator == SQL_NULL_DATA)
+ continue;
+
if ((res != SQL_SUCCESS) && (res != SQL_SUCCESS_WITH_INFO)) {
ast_log(LOG_WARNING, "SQL Get Data error!\n[%s]\n\n", sql);
if (var)
@@ -189,6 +195,7 @@ static struct ast_config *realtime_multi_odbc(const char *database, const char *
SQLSMALLINT datatype;
SQLSMALLINT decimaldigits;
SQLSMALLINT nullable;
+ SQLINTEGER indicator;
va_list aq;
va_copy(aq, ap);
@@ -293,7 +300,12 @@ static struct ast_config *realtime_multi_odbc(const char *database, const char *
ast_category_destroy(cat);
continue;
}
- res = SQLGetData(stmt, x + 1, SQL_CHAR, rowdata, sizeof(rowdata), NULL);
+
+ indicator = 0;
+ res = SQLGetData(stmt, x + 1, SQL_CHAR, rowdata, sizeof(rowdata), &indicator);
+ if (indicator == SQL_NULL_DATA)
+ continue;
+
if ((res != SQL_SUCCESS) && (res != SQL_SUCCESS_WITH_INFO)) {
ast_log(LOG_WARNING, "SQL Get Data error!\n[%s]\n\n", sql);
ast_category_destroy(cat);