Applied changes as per review

This commit is contained in:
Jenny Tam 2017-12-13 12:51:22 -08:00
parent 6a7a0d78e0
commit 292811ffee
3 changed files with 27 additions and 18 deletions

View file

@ -68,6 +68,9 @@ binding parameters, including output parameters, using the simplified syntax.
die("sqlsrv_execute failed.");
}
$textValues = array("This is some text meant to test binding parameters to streams",
"This is some more text meant to test binding parameters to streams");
$k = 0;
while (sqlsrv_fetch($stmt)) {
$id = sqlsrv_get_field($stmt, 0, SQLSRV_PHPTYPE_STRING(SQLSRV_ENC_CHAR));
echo "$id\n";
@ -85,7 +88,9 @@ binding parameters, including output parameters, using the simplified syntax.
} else {
while (!feof($stream)) {
$str = fread($stream, 10000);
echo $str;
if ($str !== $textValues[$k++]) {
fatalError("Incorrect data: \'$str\'!\n");
}
}
}
echo "\n";
@ -129,14 +134,14 @@ binding parameters, including output parameters, using the simplified syntax.
sqlsrv_free_stmt($stmt);
sqlsrv_close($conn);
?>
--EXPECTREGEX--
--EXPECT--
1
12\.0
12.0
testtestte
(This is some text meant to test binding parameters to streams)?
2
13\.0
13.0
testtestte
(This is some more text meant to test binding parameters to streams)?
3
4

View file

@ -50,14 +50,16 @@ sqlsrv_query test. Performs same tasks as 0006.phpt, using sqlsrv_query.
$stream = sqlsrv_get_field($stmt, 3, SQLSRV_PHPTYPE_STREAM(SQLSRV_ENC_BINARY));
if (!$stream) {
if (AE\isColEncrypted()) {
echo sqlsrv_errors()[0]['message'];
verifyError(sqlsrv_errors()[0], 'IMSSP', 'Connection with Column Encryption enabled does not support fetching stream. Please fetch the data as a string.');
} else {
fatalError('Fetching data stream failed!');
}
} else {
while (!feof($stream)) {
$str = fread($stream, 4000);
echo $str;
if ($str !== "This is some text meant to test binding parameters to streams") {
fatalError("Incorrect data: \'$str\'!\n");
}
}
}
echo "\n";
@ -69,8 +71,8 @@ sqlsrv_query test. Performs same tasks as 0006.phpt, using sqlsrv_query.
sqlsrv_close($conn);
?>
--EXPECTREGEX--
--EXPECT--
1
12\.0
12.0
testtestte
(This is some text meant to test binding parameters to streams|Connection with Column Encryption enabled does not support fetching stream. Please fetch the data as a string.)

View file

@ -115,14 +115,16 @@ binding streams using full syntax.
$stream = sqlsrv_get_field($stmt, 3, SQLSRV_PHPTYPE_STREAM(SQLSRV_ENC_BINARY));
if (!$stream) {
if (AE\isColEncrypted()) {
echo sqlsrv_errors()[0]['message'];
verifyError(sqlsrv_errors()[0], 'IMSSP', 'Connection with Column Encryption enabled does not support fetching stream. Please fetch the data as a string.');
} else {
fatalError('Fetching data stream failed!');
}
} else {
while (!feof($stream)) {
$str = fread($stream, 10000);
echo $str;
if ($str !== "This is some text meant to test binding parameters to streams") {
fatalError("Incorrect data: \'$str\'!\n");
}
}
}
echo "\n";
@ -161,11 +163,11 @@ binding streams using full syntax.
dropTable($conn, $tableName);
sqlsrv_close($conn);
?>
--EXPECTREGEX--
sqlsrv_query\(2\) failed\.
sqlsrv_query\(3\) failed\.
--EXPECT--
sqlsrv_query(2) failed.
sqlsrv_query(3) failed.
1
12\.0
12.0
testtestte
(This is some text meant to test binding parameters to streams|Connection with Column Encryption enabled does not support fetching stream. Please fetch the data as a string.)
Done