got rid of execReturn check since SQL_SUCCESS is 0

This commit is contained in:
v-kaywon 2017-04-03 12:43:08 -07:00
parent 8f67221e18
commit ff3a23f442
2 changed files with 14 additions and 18 deletions

View file

@ -695,19 +695,17 @@ zend_long pdo_sqlsrv_dbh_do( pdo_dbh_t *dbh, const char *sql, size_t sql_len TSR
// since the user can give us a compound statement, we return the row count for the last set, and since the row count
// isn't guaranteed to be valid until all the results have been fetched, we fetch them all first.
if ( execReturn ) {
if ( execReturn != SQL_NO_DATA && core_sqlsrv_has_any_result( driver_stmt TSRMLS_CC )) {
if ( execReturn != SQL_NO_DATA && core_sqlsrv_has_any_result( driver_stmt TSRMLS_CC )) {
SQLRETURN r = SQL_SUCCESS;
SQLRETURN r = SQL_SUCCESS;
do {
do {
rows = core::SQLRowCount( driver_stmt TSRMLS_CC );
rows = core::SQLRowCount( driver_stmt TSRMLS_CC );
r = core::SQLMoreResults( driver_stmt TSRMLS_CC );
r = core::SQLMoreResults( driver_stmt TSRMLS_CC );
} while ( r != SQL_NO_DATA );
}
} while ( r != SQL_NO_DATA );
}
// returning -1 forces PDO to return false, which signals an error occurred. SQLRowCount returns -1 for a number of cases

View file

@ -554,17 +554,15 @@ int pdo_sqlsrv_stmt_execute(pdo_stmt_t *stmt TSRMLS_DC)
SQLRETURN execReturn = core_sqlsrv_execute( driver_stmt TSRMLS_CC, query, query_len );
if ( execReturn ) {
if ( execReturn == SQL_NO_DATA ) {
stmt->column_count = 0;
stmt->row_count = 0;
}
else {
stmt->column_count = core::SQLNumResultCols( driver_stmt TSRMLS_CC );
if ( execReturn == SQL_NO_DATA ) {
stmt->column_count = 0;
stmt->row_count = 0;
}
else {
stmt->column_count = core::SQLNumResultCols( driver_stmt TSRMLS_CC );
// return the row count regardless if there are any rows or not
stmt->row_count = core::SQLRowCount( driver_stmt TSRMLS_CC );
}
// return the row count regardless if there are any rows or not
stmt->row_count = core::SQLRowCount( driver_stmt TSRMLS_CC );
}
// workaround for a bug in the PDO driver manager. It is fairly simple to crash the PDO driver manager with