Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for redundant calls to SQLNumResultCols and SQLRowCount #972

Merged
merged 8 commits into from
Apr 15, 2019
Merged

Fix for redundant calls to SQLNumResultCols and SQLRowCount #972

merged 8 commits into from
Apr 15, 2019

Conversation

david-puglielli
Copy link
Contributor

@david-puglielli david-puglielli commented Apr 11, 2019

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
@coveralls
Copy link

coveralls commented Apr 11, 2019

Coverage Status

Coverage increased (+0.002%) to 73.213% when pulling ad1d990 on david-puglielli:redundant-apis into 1e4f014 on Microsoft:dev.

@codecov-io
Copy link

codecov-io commented Apr 11, 2019

Codecov Report

Merging #972 into dev will decrease coverage by 0.07%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff            @@
##              dev    #972      +/-   ##
=========================================
- Coverage   81.38%   81.3%   -0.08%     
=========================================
  Files          25      25              
  Lines        7758    7790      +32     
=========================================
+ Hits         6314    6334      +20     
- Misses       1444    1456      +12
Impacted Files Coverage Δ
...c14/x86/php-7.1.28-src/ext/pdo_sqlsrv/pdo_stmt.cpp 83.98% <0%> (-1.13%) ⬇️
...x86/php-7.1.28-src/ext/sqlsrv/shared/core_sqlsrv.h 86.49% <0%> (-0.37%) ⬇️
...x86/php-7.1.28-src/ext/sqlsrv/shared/core_stmt.cpp 86.25% <0%> (-0.09%) ⬇️
...php-7.1.28-src/ext/pdo_sqlsrv/shared/core_stmt.cpp 79.14% <0%> (-0.04%) ⬇️
...php-7.1.28-src/ext/pdo_sqlsrv/shared/core_sqlsrv.h 84.42% <0%> (ø) ⬆️
...phpdev/vc14/x86/php-7.1.28-src/ext/sqlsrv/stmt.cpp 89.51% <0%> (+0.06%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 1e4f014...ad1d990. Read the comment docs.

@david-puglielli david-puglielli requested a review from yitam April 11, 2019 20:16
@@ -196,7 +196,7 @@ ss_error SS_ERRORS[] = {

{
SQLSRV_ERROR_NO_FIELDS,
{ IMSSP, (SQLCHAR*)"The active result for the query contains no fields.", -28, false }
{ IMSSP, (SQLCHAR*)"The active result for the query contains no fields, so no result set was created.", -28, false }
},

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest not to change the existing error message

Copy link
Contributor

@yitam yitam left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please excuse my multiple comments. I forgot to start a review.

if (stmt->columns_rows_obtained == false) {
num_cols = core::SQLNumResultCols(stmt TSRMLS_CC);
} else {
num_cols = stmt->column_count;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See my comment above

Copy link
Contributor

@yitam yitam Apr 15, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Again, see my earlier comment about setting stmt->column_count after calling SQLNumResultCols

Copy link
Contributor

@yitam yitam left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, but please see my comments

@@ -828,7 +826,7 @@ bool core_sqlsrv_fetch( _Inout_ sqlsrv_stmt* stmt, _In_ SQLSMALLINT fetch_orient
// First time only
if ( !stmt->fetch_called ) {
SQLSMALLINT has_fields;
if (stmt->columns_rows_obtained) {
if (stmt->column_count != ACTIVE_NUM_COLS_INVALID) {
has_fields = stmt->column_count;
} else {
has_fields = core::SQLNumResultCols( stmt TSRMLS_CC );
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After calling SQLNumResultCols, do you set stmt->column_count? If not, when?

if (stmt->columns_rows_obtained == false) {
num_cols = core::SQLNumResultCols(stmt TSRMLS_CC);
} else {
num_cols = stmt->column_count;
Copy link
Contributor

@yitam yitam Apr 15, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Again, see my earlier comment about setting stmt->column_count after calling SQLNumResultCols

@david-puglielli david-puglielli merged commit a3456cd into microsoft:dev Apr 15, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants