From 57e58a7cb110c4e6be200278a7bd44b53dc5109f Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Thu, 15 Jan 2009 23:40:11 +0000 Subject: [PATCH] fix ignored error condition bug reported on the dev list git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@11244 d0543943-73ff-0310-b7d9-9358b9ac24b2 --- src/switch_odbc.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/switch_odbc.c b/src/switch_odbc.c index 41628415e9..502f7014ba 100644 --- a/src/switch_odbc.c +++ b/src/switch_odbc.c @@ -331,7 +331,8 @@ SWITCH_DECLARE(switch_odbc_status_t) switch_odbc_handle_callback_exec_detailed(c SQLLEN m = 0, t = 0; char *err_str = NULL; int result; - + int err = 0; + switch_assert(callback != NULL); if (!db_is_up(handle)) { @@ -366,6 +367,7 @@ SWITCH_DECLARE(switch_odbc_status_t) switch_odbc_handle_callback_exec_detailed(c int done = 0; if (!(result = SQLFetch(stmt)) == SQL_SUCCESS) { + err++; break; } @@ -407,9 +409,11 @@ SWITCH_DECLARE(switch_odbc_status_t) switch_odbc_handle_callback_exec_detailed(c SQLFreeHandle(SQL_HANDLE_STMT, stmt); - return SWITCH_ODBC_SUCCESS; + if (!err) { + return SWITCH_ODBC_SUCCESS; + } - error: + error: /* err_str is already defined for some error cases */ if (err_str != NULL) {