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

Reverted change handling bigint output parameters #744

Merged
merged 4 commits into from
Apr 11, 2018
Merged

Reverted change handling bigint output parameters #744

merged 4 commits into from
Apr 11, 2018

Conversation

david-puglielli
Copy link
Contributor

@david-puglielli david-puglielli commented Apr 10, 2018

Reverted #567. Fixes the issue in #699.

This change is Reviewable

@david-puglielli david-puglielli requested a review from yitam April 10, 2018 00:19
@coveralls
Copy link

coveralls commented Apr 10, 2018

Coverage Status

Coverage decreased (-0.08%) to 73.221% when pulling bbf951c on david-puglielli:Revert-bigint-change into dd64980 on Microsoft:dev.

@@ -26,7 +26,8 @@ insertRow($conn, $tbname, array("c1_bigint" => 922337203685479936));
$outSql = "{CALL $spname (?)}";
$bigintOut = 0;
$stmt = $conn->prepare($outSql);
$stmt->bindParam(1, $bigintOut, PDO::PARAM_INT, PDO::SQLSRV_PARAM_OUT_DEFAULT_SIZE);
// $stmt->bindParam(1, $bigintOut, PDO::PARAM_INT, PDO::SQLSRV_PARAM_OUT_DEFAULT_SIZE);
$stmt->bindParam(1, $bigintOut, PDO::PARAM_STR, 2048);
$stmt->execute();
printf("Large bigint output:\n" );
Copy link
Contributor

Choose a reason for hiding this comment

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

please remove the commented lines in the test

$stmt = sqlsrv_prepare($conn, $outSql, array(array(&$bigintOut, SQLSRV_PARAM_OUT)));
// $stmt = sqlsrv_prepare($conn, $outSql, array(array(&$bigintOut, SQLSRV_PARAM_OUT)));
// $stmt = sqlsrv_prepare($conn, $outSql, array(array(&$bigintOut, SQLSRV_PARAM_OUT, null, SQLSRV_SQLTYPE_BIGINT))); <-- this works
$stmt = sqlsrv_prepare($conn, $outSql, array(array(&$bigintOut, SQLSRV_PARAM_OUT, null, SQLSRV_SQLTYPE_VARCHAR(256)))); //<-- this also works
sqlsrv_execute($stmt);
Copy link
Contributor

Choose a reason for hiding this comment

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

same for this one: remove the commented lines and unnecessary comments
also, you might want to do one as BIGINT and the other as VARCHAR (256 is unnecessarily large... you can try a smaller size for the VARCHAR)

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 review the pdo ae output tests too.

sqlsrv_execute($stmt);
printf("Large bigint output:\n");
var_dump($bigintOut);
printf("\n");

// Call stored procedure with SQLSRV_PARAM_INOUT
$bigintOut = 0;
$stmt = sqlsrv_prepare($conn, $outSql, array(array(&$bigintOut, SQLSRV_PARAM_INOUT)));
$stmt = sqlsrv_prepare($conn, $outSql, array(array(&$bigintOut, SQLSRV_PARAM_INOUT, null, SQLSRV_SQLTYPE_VARCHAR(20))));
Copy link
Contributor

Choose a reason for hiding this comment

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

Having size = 20 might be a bit too small if it's a negative number (of course in this example it's fine)

@@ -35,7 +35,7 @@ printf("\n");
// Call stored procedure with inout
$bigintOut = 0;
$stmt = $conn->prepare($outSql);
$stmt->bindParam(1, $bigintOut, PDO::PARAM_INT | PDO::PARAM_INPUT_OUTPUT, PDO::SQLSRV_PARAM_OUT_DEFAULT_SIZE);
$stmt->bindParam(1, $bigintOut, PDO::PARAM_STR | PDO::PARAM_INPUT_OUTPUT, 2048);
$stmt->execute();
Copy link
Contributor

Choose a reason for hiding this comment

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

Perhaps not 2048 but a size that's a bit larger than 20?

@codecov-io
Copy link

codecov-io commented Apr 11, 2018

Codecov Report

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

Impacted file tree graph

@@            Coverage Diff             @@
##              dev     #744      +/-   ##
==========================================
- Coverage   78.99%   78.89%   -0.11%     
==========================================
  Files          25       25              
  Lines        7190     7149      -41     
==========================================
- Hits         5680     5640      -40     
+ Misses       1510     1509       -1
Impacted Files Coverage Δ
...x86/php-7.1.16-src/ext/sqlsrv/shared/core_stmt.cpp 83.71% <0%> (-0.6%) ⬇️
...php-7.1.16-src/ext/pdo_sqlsrv/shared/core_stmt.cpp 64.99% <0%> (-0.36%) ⬇️
...php-7.1.16-src/ext/pdo_sqlsrv/shared/core_sqlsrv.h 80.14% <0%> (-0.22%) ⬇️
...x86/php-7.1.16-src/ext/sqlsrv/shared/core_sqlsrv.h 83.46% <0%> (-0.2%) ⬇️
.../php/x86/php-7.1.16-src/ext/pdo_sqlsrv/pdo_dbh.cpp 92.25% <0%> (+0.2%) ⬆️

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 dd64980...bbf951c. Read the comment docs.

printValues($errMsg, $det, $rand, $ord0, $ord1);
}
echo "Something went wrong. This should not have happened\n";
printValues($errMsg, $det, $rand, $ord0, $ord1);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

What happens if $pdoParamType is not PARAM_STR or PARAM_BOOL? Is this else branch not hit?

Copy link
Contributor

Choose a reason for hiding this comment

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

There are only five different PDO PARAM types, PARAM_NULL and PARAM_LOB will result in an exception, and now PARAM_INT will be skipped with non-AE. With AE, PARAM_INT will also result in an exception.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok I see

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.

Unless you have more questions about the pdo tests?

@david-puglielli
Copy link
Contributor Author

Nope, I'll merge when AppVeyor completes successfully.

@david-puglielli david-puglielli merged commit 454bc27 into microsoft:dev Apr 11, 2018
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.

4 participants