Moved check to core_sqlsrv_next_result to avoid suppressing a different error message

This commit is contained in:
David Puglielli 2017-09-26 18:33:49 -07:00
parent 1045ea40a9
commit 68bb42b2cf
3 changed files with 12 additions and 24 deletions

View file

@ -1067,18 +1067,6 @@ int pdo_sqlsrv_stmt_next_rowset( _Inout_ pdo_stmt_t *stmt TSRMLS_DC )
SQLSRV_ASSERT( driver_stmt != NULL, "pdo_sqlsrv_stmt_next_rowset: driver_data object was null" );
// Make sure that the result set is not null. Null means SQLNumResultCols returns 0
// and SQLRowCount is not > 0. Normally this error is handled in core_sqlsrv_fetch(),
// but if the user calls nextRowset() before fetch() the error is never shown
// so we handle it here.
bool has_result = core_sqlsrv_has_any_result( driver_stmt );
if(!driver_stmt->fetch_called){
CHECK_CUSTOM_ERROR( !has_result, driver_stmt, SQLSRV_ERROR_NO_FIELDS ) {
throw core::CoreException();
}
}
core_sqlsrv_next_result( static_cast<sqlsrv_stmt*>( stmt->driver_data ) TSRMLS_CC );
// clear the current meta data since the new result will generate new meta data

View file

@ -1058,6 +1058,18 @@ void core_sqlsrv_next_result( _Inout_ sqlsrv_stmt* stmt TSRMLS_DC, _In_ bool fin
throw core::CoreException();
}
// Make sure that the result set is not null. Null means SQLNumResultCols returns 0
// and SQLRowCount is not > 0. Normally this error is handled in core_sqlsrv_fetch(),
// but if the user calls nextRowset() before fetch() the error is never shown
// so we handle it here.
bool has_result = core_sqlsrv_has_any_result( stmt );
if(!driver_stmt->fetch_called){
CHECK_CUSTOM_ERROR( !has_result, stmt, SQLSRV_ERROR_NO_FIELDS ) {
throw core::CoreException();
}
}
close_active_stream( stmt TSRMLS_CC );
//Clear column sql types and sql display sizes.

View file

@ -561,18 +561,6 @@ PHP_FUNCTION( sqlsrv_next_result )
try {
// Make sure that the result set is not null. Null means SQLNumResultCols returns 0
// and SQLRowCount is not > 0. Normally this error is handled in core_sqlsrv_fetch(),
// but if the user calls sqlsrv_next_result() before fetch() the error is never shown
// so we handle it here.
bool has_result = core_sqlsrv_has_any_result( stmt );
if(!stmt->fetch_called){
CHECK_CUSTOM_ERROR( !has_result, stmt, SQLSRV_ERROR_NO_FIELDS ) {
throw core::CoreException();
}
}
core_sqlsrv_next_result( stmt TSRMLS_CC, true );
if( stmt->past_next_result_end ) {