FSCORE-276

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@11331 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Anthony Minessale 2009-01-21 18:44:07 +00:00
parent 4b51419e3a
commit 854f3f642a

View File

@ -32,6 +32,10 @@
#include <switch.h> #include <switch.h>
#include <switch_odbc.h> #include <switch_odbc.h>
#if (ODBCVER < 0x0300)
#define SQL_NO_DATA SQL_SUCCESS
#endif
struct switch_odbc_handle { struct switch_odbc_handle {
char *dsn; char *dsn;
char *username; char *username;
@ -222,6 +226,10 @@ static int db_is_up(switch_odbc_handle_t *handle)
result = SQLExecute(stmt); result = SQLExecute(stmt);
if (result != SQL_SUCCESS && result != SQL_SUCCESS_WITH_INFO) {
goto error;
}
SQLRowCount (stmt, &m); SQLRowCount (stmt, &m);
rc = SQLNumResultCols (stmt, &nresultcols); rc = SQLNumResultCols (stmt, &nresultcols);
if (rc != SQL_SUCCESS){ if (rc != SQL_SUCCESS){
@ -351,7 +359,7 @@ SWITCH_DECLARE(switch_odbc_status_t) switch_odbc_handle_callback_exec_detailed(c
result = SQLExecute(stmt); 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; goto error;
} }
@ -366,8 +374,12 @@ SWITCH_DECLARE(switch_odbc_status_t) switch_odbc_handle_callback_exec_detailed(c
int y = 0; int y = 0;
int done = 0; int done = 0;
if (!(result = SQLFetch(stmt)) == SQL_SUCCESS) { result = SQLFetch(stmt);
if (result != SQL_SUCCESS) {
if (result != SQL_NO_DATA){
err++; err++;
}
break; break;
} }