Minor fixes

This commit is contained in:
David Puglielli 2017-09-29 20:47:24 -07:00
parent 494527d465
commit 4151f8f5d1
4 changed files with 7 additions and 2 deletions

View file

@ -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 // 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 // nextRowset() on a non-null result set before calling fetch()), it is handled
// in core_sqlsrv_next_result() below. // 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 ) { CHECK_CUSTOM_ERROR( !has_result, driver_stmt, SQLSRV_ERROR_NO_FIELDS ) {
throw core::CoreException(); throw core::CoreException();
} }

View file

@ -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 // 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 // sqlsrv_next_result() on a non-null result set before calling fetch()), it is handled
// in core_sqlsrv_next_result() below. // in core_sqlsrv_next_result() below.
if(!stmt->fetch_called){ if( !stmt->fetch_called ) {
CHECK_CUSTOM_ERROR( !has_result, stmt, SQLSRV_ERROR_NO_FIELDS ) { CHECK_CUSTOM_ERROR( !has_result, stmt, SQLSRV_ERROR_NO_FIELDS ) {
throw core::CoreException(); throw core::CoreException();
} }

View file

@ -1,4 +1,6 @@
--TEST-- --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. Test that calling nextRowset() on an empty result set produces the correct error message. Fix for Github 507.
--SKIPIF-- --SKIPIF--
<?php require('skipif.inc'); ?> <?php require('skipif.inc'); ?>

View file

@ -1,4 +1,6 @@
--TEST-- --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. Test that calling sqlsrv_next_result() on a null result set produces the correct error message. Fix for Github 507.
--SKIPIF-- --SKIPIF--
<?php require('skipif.inc'); ?> <?php require('skipif.inc'); ?>
@ -58,6 +60,7 @@ print_r(sqlsrv_errors());
$stmt = sqlsrv_query($conn, "DROP TABLE TestEmptySetTable"); $stmt = sqlsrv_query($conn, "DROP TABLE TestEmptySetTable");
$stmt = sqlsrv_query($conn, "DROP PROCEDURE TestEmptySetProc"); $stmt = sqlsrv_query($conn, "DROP PROCEDURE TestEmptySetProc");
sqlsrv_free_stmt($stmt);
sqlsrv_close($conn); sqlsrv_close($conn);
?> ?>
--EXPECTF-- --EXPECTF--