git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@5955 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Anthony Minessale 2007-10-18 00:10:48 +00:00
parent 48b8f1515f
commit 89472232ec

View File

@ -305,7 +305,7 @@ SWITCH_DECLARE(switch_odbc_status_t) switch_odbc_handle_callback_exec(switch_odb
{ {
SQLHSTMT stmt = NULL; SQLHSTMT stmt = NULL;
SQLSMALLINT c = 0, x = 0; SQLSMALLINT c = 0, x = 0;
SQLINTEGER m = 0; SQLINTEGER m = 0, t = 0;
int result; int result;
assert(callback != NULL); assert(callback != NULL);
@ -333,6 +333,7 @@ SWITCH_DECLARE(switch_odbc_status_t) switch_odbc_handle_callback_exec(switch_odb
SQLRowCount(stmt, &m); SQLRowCount(stmt, &m);
if (m > 0) { if (m > 0) {
for (t = 0; t < m; t++) {
int name_len = 256; int name_len = 256;
char **names; char **names;
char **vals; char **vals;
@ -343,7 +344,7 @@ SWITCH_DECLARE(switch_odbc_status_t) switch_odbc_handle_callback_exec(switch_odb
} }
names = calloc(c, sizeof(*names)); names = calloc(c, sizeof(*names));
vals = calloc(c, sizeof(*names)); vals = calloc(c, sizeof(*vals));
assert(names && vals); assert(names && vals);
@ -362,7 +363,9 @@ SWITCH_DECLARE(switch_odbc_status_t) switch_odbc_handle_callback_exec(switch_odb
y++; y++;
} }
callback(pdata, y, vals, names); if (callback(pdata, y, vals, names)) {
break;
}
for (x = 0; x < y; x++) { for (x = 0; x < y; x++) {
free(names[x]); free(names[x]);
@ -371,6 +374,7 @@ SWITCH_DECLARE(switch_odbc_status_t) switch_odbc_handle_callback_exec(switch_odb
free(names); free(names);
free(vals); free(vals);
} }
}
SQLFreeHandle(SQL_HANDLE_STMT, stmt); SQLFreeHandle(SQL_HANDLE_STMT, stmt);