mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-30 10:33:13 +00:00
ensure that res_config_odbc can handle columns with NULL values (bug #3787)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@5493 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -49,6 +49,7 @@ static struct ast_variable *realtime_odbc(const char *database, const char *tabl
|
|||||||
SQLSMALLINT datatype;
|
SQLSMALLINT datatype;
|
||||||
SQLSMALLINT decimaldigits;
|
SQLSMALLINT decimaldigits;
|
||||||
SQLSMALLINT nullable;
|
SQLSMALLINT nullable;
|
||||||
|
SQLINTEGER indicator;
|
||||||
va_list aq;
|
va_list aq;
|
||||||
|
|
||||||
va_copy(aq, ap);
|
va_copy(aq, ap);
|
||||||
@@ -136,7 +137,12 @@ static struct ast_variable *realtime_odbc(const char *database, const char *tabl
|
|||||||
ast_variables_destroy(var);
|
ast_variables_destroy(var);
|
||||||
return NULL;
|
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)) {
|
if ((res != SQL_SUCCESS) && (res != SQL_SUCCESS_WITH_INFO)) {
|
||||||
ast_log(LOG_WARNING, "SQL Get Data error!\n[%s]\n\n", sql);
|
ast_log(LOG_WARNING, "SQL Get Data error!\n[%s]\n\n", sql);
|
||||||
if (var)
|
if (var)
|
||||||
@@ -189,6 +195,7 @@ static struct ast_config *realtime_multi_odbc(const char *database, const char *
|
|||||||
SQLSMALLINT datatype;
|
SQLSMALLINT datatype;
|
||||||
SQLSMALLINT decimaldigits;
|
SQLSMALLINT decimaldigits;
|
||||||
SQLSMALLINT nullable;
|
SQLSMALLINT nullable;
|
||||||
|
SQLINTEGER indicator;
|
||||||
|
|
||||||
va_list aq;
|
va_list aq;
|
||||||
va_copy(aq, ap);
|
va_copy(aq, ap);
|
||||||
@@ -293,7 +300,12 @@ static struct ast_config *realtime_multi_odbc(const char *database, const char *
|
|||||||
ast_category_destroy(cat);
|
ast_category_destroy(cat);
|
||||||
continue;
|
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)) {
|
if ((res != SQL_SUCCESS) && (res != SQL_SUCCESS_WITH_INFO)) {
|
||||||
ast_log(LOG_WARNING, "SQL Get Data error!\n[%s]\n\n", sql);
|
ast_log(LOG_WARNING, "SQL Get Data error!\n[%s]\n\n", sql);
|
||||||
ast_category_destroy(cat);
|
ast_category_destroy(cat);
|
||||||
|
Reference in New Issue
Block a user