]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
fix ignored error condition bug reported on the dev list
authorAnthony Minessale <anthony.minessale@gmail.com>
Thu, 15 Jan 2009 23:40:11 +0000 (23:40 +0000)
committerAnthony Minessale <anthony.minessale@gmail.com>
Thu, 15 Jan 2009 23:40:11 +0000 (23:40 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@11244 d0543943-73ff-0310-b7d9-9358b9ac24b2

src/switch_odbc.c

index 41628415e9e975c4255c57baf4b564014f1e2975..502f7014badaf456655b5a2c7734978a1002b897 100644 (file)
@@ -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) {