[Asterisk-cvs] asterisk/res res_config_odbc.c,1.25,1.26

kpfleming at lists.digium.com kpfleming at lists.digium.com
Thu Apr 21 21:09:18 CDT 2005


Update of /usr/cvsroot/asterisk/res
In directory mongoose.digium.com:/tmp/cvs-serv12624/res

Modified Files:
	res_config_odbc.c 
Log Message:
ensure that res_config_odbc can handle columns with NULL values (bug #3787)


Index: res_config_odbc.c
===================================================================
RCS file: /usr/cvsroot/asterisk/res/res_config_odbc.c,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -d -r1.25 -r1.26
--- res_config_odbc.c	21 Apr 2005 06:02:44 -0000	1.25
+++ res_config_odbc.c	22 Apr 2005 01:59:53 -0000	1.26
@@ -49,6 +49,7 @@
 	SQLSMALLINT datatype;
 	SQLSMALLINT decimaldigits;
 	SQLSMALLINT nullable;
+	SQLINTEGER indicator;
 	va_list aq;
 	
 	va_copy(aq, ap);
@@ -136,7 +137,12 @@
 					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 @@
 	SQLSMALLINT datatype;
 	SQLSMALLINT decimaldigits;
 	SQLSMALLINT nullable;
+	SQLINTEGER indicator;
 
 	va_list aq;
 	va_copy(aq, ap);
@@ -293,7 +300,12 @@
 				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);




More information about the svn-commits mailing list