From 4151f8f5d1d4c2bb8f31d561a9a96ae37c895d5f Mon Sep 17 00:00:00 2001 From: David Puglielli Date: Fri, 29 Sep 2017 20:47:24 -0700 Subject: [PATCH] Minor fixes --- source/pdo_sqlsrv/pdo_stmt.cpp | 2 +- source/sqlsrv/stmt.cpp | 2 +- test/functional/pdo_sqlsrv/pdo_empty_result_error.phpt | 2 ++ test/functional/sqlsrv/sqlsrv_empty_result_error.phpt | 3 +++ 4 files changed, 7 insertions(+), 2 deletions(-) diff --git a/source/pdo_sqlsrv/pdo_stmt.cpp b/source/pdo_sqlsrv/pdo_stmt.cpp index fe2ff5fa..57ebd9d5 100644 --- a/source/pdo_sqlsrv/pdo_stmt.cpp +++ b/source/pdo_sqlsrv/pdo_stmt.cpp @@ -1088,7 +1088,7 @@ int pdo_sqlsrv_stmt_next_rowset( _Inout_ pdo_stmt_t *stmt TSRMLS_DC ) // Note that if fetch_called is false but has_result is true (i.e. the user is calling // nextRowset() on a non-null result set before calling fetch()), it is handled // in core_sqlsrv_next_result() below. - if(!driver_stmt->fetch_called){ + if( !driver_stmt->fetch_called ) { CHECK_CUSTOM_ERROR( !has_result, driver_stmt, SQLSRV_ERROR_NO_FIELDS ) { throw core::CoreException(); } diff --git a/source/sqlsrv/stmt.cpp b/source/sqlsrv/stmt.cpp index 8f5abb6c..b9c3bbfb 100644 --- a/source/sqlsrv/stmt.cpp +++ b/source/sqlsrv/stmt.cpp @@ -581,7 +581,7 @@ PHP_FUNCTION( sqlsrv_next_result ) // Note that if fetch_called is false but has_result is true (i.e. the user is calling // sqlsrv_next_result() on a non-null result set before calling fetch()), it is handled // in core_sqlsrv_next_result() below. - if(!stmt->fetch_called){ + if( !stmt->fetch_called ) { CHECK_CUSTOM_ERROR( !has_result, stmt, SQLSRV_ERROR_NO_FIELDS ) { throw core::CoreException(); } diff --git a/test/functional/pdo_sqlsrv/pdo_empty_result_error.phpt b/test/functional/pdo_sqlsrv/pdo_empty_result_error.phpt index dda98156..ae3bf414 100644 --- a/test/functional/pdo_sqlsrv/pdo_empty_result_error.phpt +++ b/test/functional/pdo_sqlsrv/pdo_empty_result_error.phpt @@ -1,4 +1,6 @@ --TEST-- +Error messages from null result sets +--DESCRIPTION-- Test that calling nextRowset() on an empty result set produces the correct error message. Fix for Github 507. --SKIPIF-- diff --git a/test/functional/sqlsrv/sqlsrv_empty_result_error.phpt b/test/functional/sqlsrv/sqlsrv_empty_result_error.phpt index ba07801e..8c2210e2 100644 --- a/test/functional/sqlsrv/sqlsrv_empty_result_error.phpt +++ b/test/functional/sqlsrv/sqlsrv_empty_result_error.phpt @@ -1,4 +1,6 @@ --TEST-- +Error messages from null result sets +--DESCRIPTION-- Test that calling sqlsrv_next_result() on a null result set produces the correct error message. Fix for Github 507. --SKIPIF-- @@ -58,6 +60,7 @@ print_r(sqlsrv_errors()); $stmt = sqlsrv_query($conn, "DROP TABLE TestEmptySetTable"); $stmt = sqlsrv_query($conn, "DROP PROCEDURE TestEmptySetProc"); +sqlsrv_free_stmt($stmt); sqlsrv_close($conn); ?> --EXPECTF--