diff --git a/test/functional/pdo_sqlsrv/pdo_ae_output_param_char_size.phpt b/test/functional/pdo_sqlsrv/pdo_ae_output_param_char_size.phpt index 66a68004..81e79255 100644 --- a/test/functional/pdo_sqlsrv/pdo_ae_output_param_char_size.phpt +++ b/test/functional/pdo_sqlsrv/pdo_ae_output_param_char_size.phpt @@ -120,7 +120,7 @@ function testOutputChars($inout) if ($found === false) { printValues($errMsg, $det, $rand, $input0, $input1); } - } elseif ($pdoParamType == PDO::PARAM_BOOL) { + } elseif ($pdoParamType == PDO::PARAM_BOOL || $pdoParamType == PDO::PARAM_INT) { if (isAEConnected()) { // Expected error 22003: "Numeric value out of range" $found = strpos($message, $errors['22003']); diff --git a/test/functional/pdo_sqlsrv/pdo_ae_output_param_datetimes.phpt b/test/functional/pdo_sqlsrv/pdo_ae_output_param_datetimes.phpt index 02e2c83f..dfd804b4 100644 --- a/test/functional/pdo_sqlsrv/pdo_ae_output_param_datetimes.phpt +++ b/test/functional/pdo_sqlsrv/pdo_ae_output_param_datetimes.phpt @@ -146,7 +146,7 @@ function testOutputDatetimes($inout) // streams cannot be specified as output parameters." $found = strpos($message, $errors['IMSSP']); } elseif (isAEConnected()) { - if ($pdoParamType == PDO::PARAM_BOOL) { + if ($pdoParamType != PDO::PARAM_STR) { // Expected error 07006: "Restricted data type attribute violation" // What does this error mean? // The data value returned for a parameter bound as @@ -159,7 +159,7 @@ function testOutputDatetimes($inout) $found = strpos($message, $error); } } else { - if ($pdoParamType == PDO::PARAM_BOOL) { + if ($pdoParamType != PDO::PARAM_STR) { $error = "Operand type clash: int is incompatible with $dataType"; } else { $error = "Error converting data type nvarchar to $dataType"; @@ -167,6 +167,7 @@ function testOutputDatetimes($inout) $found = strpos($message, $error); } if ($found === false) { + print $message . PHP_EOL; printValues($errMsg, $det, $rand, $inputValues); } } diff --git a/test/functional/pdo_sqlsrv/pdo_ae_output_param_decimals.phpt b/test/functional/pdo_sqlsrv/pdo_ae_output_param_decimals.phpt index 4f30c1a2..fce2ee4d 100644 --- a/test/functional/pdo_sqlsrv/pdo_ae_output_param_decimals.phpt +++ b/test/functional/pdo_sqlsrv/pdo_ae_output_param_decimals.phpt @@ -56,14 +56,9 @@ function compareIntegers($det, $rand, $inputValues, $pdoParamType) if (is_string($det)) { return (!compareFloats(floatval($det), $inputValues[0]) && !compareFloats(floatval($rand), $inputValues[1])); - } elseif ($pdoParamType == PDO::PARAM_INT) { - $input0 = floor($inputValues[0]); // the positive float - $input1 = ceil($inputValues[1]); // the negative float - - return ($det == $input0 && $rand == $input1); } else { - // $pdoParamType == PDO::PARAM_BOOL - // Expect bool(true) or bool(false) depending on the rounded input values + // if $pdoParamType is PDO::PARAM_BOOL, + // expect bool(true) or bool(false) depending on the rounded input values // But with AE enabled (aforementioned GitHub issue), the fetched values // are floats instead, which should be fixed $input0 = floor($inputValues[0]); // the positive float @@ -195,9 +190,9 @@ function testOutputDecimals($inout) if ($found === false) { printValues($errMsg, $det, $rand, $inputValues); } - } elseif (!isAEConnected() && $precision >= 16 && $pdoParamType == PDO::PARAM_BOOL) { + } elseif (!isAEConnected() && $precision >= 16) { // When not AE enabled, large numbers are expected to - // fail when converting to booleans + // fail when converting to booleans / integers $error = "Error converting data type $dataType to int"; $found = strpos($message, $error); if ($found === false) { diff --git a/test/functional/pdo_sqlsrv/pdo_ae_output_param_floats.phpt b/test/functional/pdo_sqlsrv/pdo_ae_output_param_floats.phpt index 54a5e4ac..61fca7c4 100644 --- a/test/functional/pdo_sqlsrv/pdo_ae_output_param_floats.phpt +++ b/test/functional/pdo_sqlsrv/pdo_ae_output_param_floats.phpt @@ -85,13 +85,6 @@ function testOutputFloats($fetchNumeric, $inout) // call stored procedure $outSql = getCallProcSqlPlaceholders($spname, 2); foreach ($pdoParamTypes as $pdoParamType) { - if ($pdoParamType == PDO::PARAM_INT && (strtoupper(substr(PHP_OS, 0, 3)) != 'WIN' || substr(PHP_VERSION, 0, 3) == "7.0")) { - // Bug 2876 in VSO: Linux or PHP 7.0 - when retrieving a float as OUTPUT - // or INOUT parameter with PDO::PARAM_INT, the returned values - // are always single digits, regardless of the original floats - continue; - } - $det = 0.0; $rand = 0.0; $stmt = $conn->prepare($outSql); diff --git a/test/functional/pdo_sqlsrv/pdo_ae_output_param_nchar_size.phpt b/test/functional/pdo_sqlsrv/pdo_ae_output_param_nchar_size.phpt index e6da0d9c..5e52558b 100644 --- a/test/functional/pdo_sqlsrv/pdo_ae_output_param_nchar_size.phpt +++ b/test/functional/pdo_sqlsrv/pdo_ae_output_param_nchar_size.phpt @@ -121,7 +121,7 @@ function testOutputNChars($inout) if ($found === false) { printValues($errMsg, $det, $rand, $input0, $input1); } - } elseif ($pdoParamType == PDO::PARAM_BOOL) { + } elseif ($pdoParamType == PDO::PARAM_BOOL || $pdoParamType == PDO::PARAM_INT) { if (isAEConnected()) { // Expected error 22003: "Numeric value out of range" $found = strpos($message, $errors['22003']); diff --git a/test/functional/pdo_sqlsrv/pdo_bigint_outparam.phpt b/test/functional/pdo_sqlsrv/pdo_bigint_outparam.phpt index 34c9ec40..bb93edab 100644 --- a/test/functional/pdo_sqlsrv/pdo_bigint_outparam.phpt +++ b/test/functional/pdo_sqlsrv/pdo_bigint_outparam.phpt @@ -26,7 +26,6 @@ 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_STR, 2048); $stmt->execute(); printf("Large bigint output:\n" ); @@ -36,7 +35,6 @@ 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(); printf("Large bigint inout:\n" ); diff --git a/test/functional/sqlsrv/sqlsrv_bigint_outparam.phpt b/test/functional/sqlsrv/sqlsrv_bigint_outparam.phpt index 2402dbba..437ec5c6 100644 --- a/test/functional/sqlsrv/sqlsrv_bigint_outparam.phpt +++ b/test/functional/sqlsrv/sqlsrv_bigint_outparam.phpt @@ -25,9 +25,7 @@ AE\insertRow($conn, $tbname, array("c1_bigint" => 922337203685479936)); // Call stored procedure with SQLSRV_PARAM_OUT $outSql = "{CALL $spname (?)}"; $bigintOut = 0; -// $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 +$stmt = sqlsrv_prepare($conn, $outSql, array(array(&$bigintOut, SQLSRV_PARAM_OUT, null, SQLSRV_SQLTYPE_BIGINT))); sqlsrv_execute($stmt); printf("Large bigint output:\n"); var_dump($bigintOut); @@ -35,9 +33,7 @@ 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_BIGINT))); <-- this works -$stmt = sqlsrv_prepare($conn, $outSql, array(array(&$bigintOut, SQLSRV_PARAM_INOUT, null, SQLSRV_SQLTYPE_VARCHAR(256)))); //<-- this also works +$stmt = sqlsrv_prepare($conn, $outSql, array(array(&$bigintOut, SQLSRV_PARAM_INOUT, null, SQLSRV_SQLTYPE_VARCHAR(20)))); sqlsrv_execute($stmt); printf("Large bigint inout:\n"); var_dump($bigintOut);