From 24d72cba240732072406739cc691517407082641 Mon Sep 17 00:00:00 2001 From: Sicong Date: Thu, 30 Nov 2023 16:52:59 -0800 Subject: [PATCH] Fix error throw for multiple result sets (#1485) --- source/pdo_sqlsrv/pdo_dbh.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/source/pdo_sqlsrv/pdo_dbh.cpp b/source/pdo_sqlsrv/pdo_dbh.cpp index e473e4bf7..a1c2ae0b0 100644 --- a/source/pdo_sqlsrv/pdo_dbh.cpp +++ b/source/pdo_sqlsrv/pdo_dbh.cpp @@ -975,7 +975,7 @@ zend_long pdo_sqlsrv_dbh_do(_Inout_ pdo_dbh_t *dbh, _In_ const zend_string *sql) // 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 != SQL_NO_DATA && core_sqlsrv_has_any_result( driver_stmt )) { + if ( core_sqlsrv_has_any_result( driver_stmt )) { SQLRETURN r = SQL_SUCCESS; @@ -987,7 +987,6 @@ zend_long pdo_sqlsrv_dbh_do(_Inout_ pdo_dbh_t *dbh, _In_ const zend_string *sql) } 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 // naturally, so we override that here with no rows returned. if( rows == -1 ) {