[Freeswitch-svn] [commit] r11331 - freeswitch/trunk/src

FreeSWITCH SVN anthm at freeswitch.org
Wed Jan 21 10:44:07 PST 2009


Author: anthm
Date: Wed Jan 21 12:44:07 2009
New Revision: 11331

Log:
FSCORE-276

Modified:
   freeswitch/trunk/src/switch_odbc.c

Modified: freeswitch/trunk/src/switch_odbc.c
==============================================================================
--- freeswitch/trunk/src/switch_odbc.c	(original)
+++ freeswitch/trunk/src/switch_odbc.c	Wed Jan 21 12:44:07 2009
@@ -32,6 +32,10 @@
 #include <switch.h>
 #include <switch_odbc.h>
 
+#if (ODBCVER < 0x0300)
+#define SQL_NO_DATA SQL_SUCCESS
+#endif 
+
 struct switch_odbc_handle {
 	char *dsn;
 	char *username;
@@ -222,6 +226,10 @@
 
 	result = SQLExecute(stmt);
 
+	if (result != SQL_SUCCESS && result != SQL_SUCCESS_WITH_INFO) {
+		goto error;
+	}
+
 	SQLRowCount (stmt, &m);
 	rc = SQLNumResultCols (stmt, &nresultcols);
 	if (rc != SQL_SUCCESS){
@@ -351,7 +359,7 @@
 
 	result = SQLExecute(stmt);
 
-	if (result != SQL_SUCCESS && result != SQL_SUCCESS_WITH_INFO) {
+	if (result != SQL_SUCCESS && result != SQL_SUCCESS_WITH_INFO && result != SQL_NO_DATA) {
 		goto error;
 	}
 
@@ -366,8 +374,12 @@
 		int y = 0;
 		int done = 0;
 
-		if (!(result = SQLFetch(stmt)) == SQL_SUCCESS) {
-			err++;
+		result = SQLFetch(stmt);
+
+		if (result != SQL_SUCCESS) {
+			if (result != SQL_NO_DATA){
+				err++;
+			}
 			break;
 		}
 



More information about the Freeswitch-svn mailing list