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

FreeSWITCH SVN silik0n at freeswitch.org
Wed Feb 18 18:54:28 PST 2009


Author: silik0n
Date: Wed Feb 18 20:54:28 2009
New Revision: 12152

Log:
Lets back this out since we should not be using this call for a UPDATE or DELETE query

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 Feb 18 20:54:28 2009
@@ -366,57 +366,55 @@
 	SQLNumResultCols(stmt, &c);
 	SQLRowCount(stmt, &m);
 
-	if (m > 0) {
-		for (t = 0 ;; t++) {
-			int name_len = 256;
-			char **names;
-			char **vals;
-			int y = 0;
-			int done = 0;
-	
-			result = SQLFetch(stmt);
-	
-			if (result != SQL_SUCCESS) {
-				if (result != SQL_NO_DATA){
-					err++;
-				}
-				break;
-			}
-	
-			names = calloc(c, sizeof(*names));
-			vals = calloc(c, sizeof(*vals));
-	
-			switch_assert(names && vals);
-	
-			for (x = 1; x <= c; x++) {
-				SQLSMALLINT NameLength, DataType, DecimalDigits, Nullable;
-				SQLULEN ColumnSize;
-				names[y] = malloc(name_len);
-				memset(names[y], 0, name_len);
-	
-				SQLDescribeCol(stmt, x, (SQLCHAR *) names[y], (SQLSMALLINT) name_len, &NameLength, &DataType, &ColumnSize, &DecimalDigits, &Nullable);
-				ColumnSize++;
-	
-				vals[y] = malloc(ColumnSize);
-				memset(vals[y], 0, ColumnSize);
-				SQLGetData(stmt, x, SQL_C_CHAR, (SQLCHAR *) vals[y], ColumnSize, NULL);
-				y++;
+	for (t = 0 ;; t++) {
+		int name_len = 256;
+		char **names;
+		char **vals;
+		int y = 0;
+		int done = 0;
+
+		result = SQLFetch(stmt);
+
+		if (result != SQL_SUCCESS) {
+			if (result != SQL_NO_DATA){
+				err++;
 			}
+			break;
+		}
 
-			if (callback(pdata, y, vals, names)) {
-				done = 1;
-			}
-	
-			for (x = 0; x < y; x++) {
-				free(names[x]);
-				free(vals[x]);
-			}
-			free(names);
-			free(vals);
+		names = calloc(c, sizeof(*names));
+		vals = calloc(c, sizeof(*vals));
+
+		switch_assert(names && vals);
+
+		for (x = 1; x <= c; x++) {
+			SQLSMALLINT NameLength, DataType, DecimalDigits, Nullable;
+			SQLULEN ColumnSize;
+			names[y] = malloc(name_len);
+			memset(names[y], 0, name_len);
+
+			SQLDescribeCol(stmt, x, (SQLCHAR *) names[y], (SQLSMALLINT) name_len, &NameLength, &DataType, &ColumnSize, &DecimalDigits, &Nullable);
+			ColumnSize++;
+
+			vals[y] = malloc(ColumnSize);
+			memset(vals[y], 0, ColumnSize);
+			SQLGetData(stmt, x, SQL_C_CHAR, (SQLCHAR *) vals[y], ColumnSize, NULL);
+			y++;
+		}
 
-			if (done) {
+		if (callback(pdata, y, vals, names)) {
+			done = 1;
+		}
+
+		for (x = 0; x < y; x++) {
+			free(names[x]);
+			free(vals[x]);
+		}
+		free(names);
+		free(vals);
+
+		if (done) {
 			break;
-			}
 		}
 	}
 	



More information about the Freeswitch-svn mailing list