-
Notifications
You must be signed in to change notification settings - Fork 375
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
Reverted change handling bigint output parameters #744
Conversation
@@ -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" ); |
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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)
There was a problem hiding this 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)))); |
There was a problem hiding this comment.
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(); |
There was a problem hiding this comment.
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 Report
@@ 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
Continue to review full report at Codecov.
|
printValues($errMsg, $det, $rand, $ord0, $ord1); | ||
} | ||
echo "Something went wrong. This should not have happened\n"; | ||
printValues($errMsg, $det, $rand, $ord0, $ord1); |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok I see
There was a problem hiding this 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?
Nope, I'll merge when AppVeyor completes successfully. |
Reverted #567. Fixes the issue in #699.
This change is