Fixed test failures by moving logic back to stmt.cpp and pdo_stmt.cpp

This commit is contained in:
David Puglielli 2017-09-21 18:27:56 -07:00
parent 8666ea63c7
commit 7046086f60
3 changed files with 17 additions and 9 deletions

View file

@ -1067,6 +1067,14 @@ 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, i.e. SQLNumResultCols() does not
// return 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.
SQLSMALLINT has_fields = core::SQLNumResultCols( stmt TSRMLS_CC );
CHECK_CUSTOM_ERROR( has_fields == 0, 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

@ -1033,15 +1033,6 @@ 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, i.e. SQLNumResultCols() does not
// return 0. Normally this error is handled in core_sqlsrv_fetch, but if the
// user calls sqlsrv_next_result() or nextRowset() before fetch() the error is
// never shown so we handle it here.
SQLSMALLINT has_fields = core::SQLNumResultCols( stmt TSRMLS_CC );
CHECK_CUSTOM_ERROR( has_fields == 0, stmt, SQLSRV_ERROR_NO_FIELDS ) {
throw core::CoreException();
}
close_active_stream( stmt TSRMLS_CC );
//Clear column sql types and sql display sizes.

View file

@ -1006,6 +1006,15 @@ PHP_FUNCTION( sqlsrv_send_stream_data )
try {
// Make sure that the result set is not null, i.e. SQLNumResultCols() does not
// return 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.
SQLSMALLINT has_fields = core::SQLNumResultCols( stmt TSRMLS_CC );
CHECK_CUSTOM_ERROR( has_fields == 0, stmt, SQLSRV_ERROR_NO_FIELDS ) {
throw core::CoreException();
}
// if everything was sent at execute time, just return that there is nothing more to send.
if( stmt->send_streams_at_exec ) {
RETURN_NULL();