mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-08-13 09:36:46 +00:00
fix Misuse of SQLRowCount, issues with MSSQL (MODAPP-105)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@8914 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
@@ -196,6 +196,9 @@ static int db_is_up(switch_odbc_handle_t *handle)
|
||||
SQLCHAR sql[255] = "";
|
||||
int max_tries = 120;
|
||||
|
||||
SQLRETURN rc;
|
||||
SQLSMALLINT nresultcols;
|
||||
|
||||
top:
|
||||
|
||||
if (!handle) {
|
||||
@@ -219,10 +222,15 @@ static int db_is_up(switch_odbc_handle_t *handle)
|
||||
|
||||
result = SQLExecute(stmt);
|
||||
|
||||
SQLRowCount(stmt, &m);
|
||||
ret = (int) m;
|
||||
|
||||
if (result < 0 || m < 0) {
|
||||
SQLRowCount (stmt, &m);
|
||||
rc = SQLNumResultCols (stmt, &nresultcols);
|
||||
if (rc != SQL_SUCCESS){
|
||||
goto error;
|
||||
}
|
||||
ret = (int) nresultcols;
|
||||
/* determine statement type */
|
||||
if (nresultcols <= 0) {
|
||||
/* statement is not a select statement */
|
||||
goto error;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user