From ad1d990cda38af30d6cd76e3adc0be42193a1438 Mon Sep 17 00:00:00 2001 From: David Puglielli Date: Mon, 15 Apr 2019 13:48:48 -0700 Subject: [PATCH] Addressed review comments --- source/shared/core_stmt.cpp | 2 ++ source/sqlsrv/stmt.cpp | 1 + 2 files changed, 3 insertions(+) diff --git a/source/shared/core_stmt.cpp b/source/shared/core_stmt.cpp index 9d7f6801..19c448e5 100644 --- a/source/shared/core_stmt.cpp +++ b/source/shared/core_stmt.cpp @@ -823,6 +823,7 @@ bool core_sqlsrv_fetch( _Inout_ sqlsrv_stmt* stmt, _In_ SQLSMALLINT fetch_orient CHECK_CUSTOM_ERROR( stmt->past_fetch_end, stmt, SQLSRV_ERROR_FETCH_PAST_END ) { throw core::CoreException(); } + // First time only if ( !stmt->fetch_called ) { SQLSMALLINT has_fields; @@ -830,6 +831,7 @@ bool core_sqlsrv_fetch( _Inout_ sqlsrv_stmt* stmt, _In_ SQLSMALLINT fetch_orient has_fields = stmt->column_count; } else { has_fields = core::SQLNumResultCols( stmt TSRMLS_CC ); + stmt->column_count = has_fields; } CHECK_CUSTOM_ERROR( has_fields == 0, stmt, SQLSRV_ERROR_NO_FIELDS ) { diff --git a/source/sqlsrv/stmt.cpp b/source/sqlsrv/stmt.cpp index 0765b7d4..9d16d24e 100644 --- a/source/sqlsrv/stmt.cpp +++ b/source/sqlsrv/stmt.cpp @@ -1793,6 +1793,7 @@ SQLSMALLINT get_resultset_meta_data(_Inout_ sqlsrv_stmt * stmt) getMetaData = true; if (stmt->column_count == ACTIVE_NUM_COLS_INVALID) { num_cols = core::SQLNumResultCols(stmt TSRMLS_CC); + stmt->column_count = num_cols; } else { num_cols = stmt->column_count; }