diff --git a/test/functional/sqlsrv/0020.phpt b/test/functional/sqlsrv/0020.phpt
index ee36eb6c..ef7df7cb 100644
--- a/test/functional/sqlsrv/0020.phpt
+++ b/test/functional/sqlsrv/0020.phpt
@@ -23,19 +23,26 @@ function runTest($fieldType)
sqlsrv_fetch($stmt)
|| die(print_r(sqlsrv_errors(), true));
- ($stream = sqlsrv_get_field($stmt, 0, SQLSRV_PHPTYPE_STREAM("char")))
- || die(print_r(sqlsrv_errors(), true));
-
- stream_filter_append($originalStream, "convert.base64-encode")
- || die(print_r(error_get_last()));
-
- while (($originalLine = fread($originalStream, 80)) &&
- ($dbLine = fread($stream, 80))) {
- if ($originalLine != $dbLine) {
- die("Not identical");
+ // Do not support getting stream if AE enabled, so expect
+ // it to fail with the correct error message
+ $stream = sqlsrv_get_field($stmt, 0, SQLSRV_PHPTYPE_STREAM("char"));
+ if ($stream) {
+ stream_filter_append($originalStream, "convert.base64-encode")
+ || die(print_r(error_get_last()));
+
+ while (($originalLine = fread($originalStream, 80)) &&
+ ($dbLine = fread($stream, 80))) {
+ if ($originalLine != $dbLine) {
+ die("Not identical");
+ }
+ }
+ } else {
+ if (AE\isColEncrypted()) {
+ 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!');
}
}
-
dropTable($conn, $params['tableName']);
sqlsrv_free_stmt($stmt) || die(print_r(sqlsrv_errors(), true));
diff --git a/test/functional/sqlsrv/0066.phpt b/test/functional/sqlsrv/0066.phpt
index 8978705e..a8bcf590 100644
--- a/test/functional/sqlsrv/0066.phpt
+++ b/test/functional/sqlsrv/0066.phpt
@@ -38,14 +38,17 @@ inserting and retrieving UTF-8 text.
$u = sqlsrv_get_field($s, 1, SQLSRV_PHPTYPE_STREAM('utf-8'));
if ($u === false) {
- die(print_r(sqlsrv_errors(), true));
+ if (AE\isColEncrypted()) {
+ verifyError(sqlsrv_errors()[0], 'IMSSP', 'Connection with Column Encryption enabled does not support fetching stream. Please fetch the data as a string.');
+ } else {
+ die(print_r(sqlsrv_errors(), true));
+ }
+ } else {
+ $utf8_2 = fread($u, 10000);
+ if ($utf8 != $utf8_2) {
+ fatalError("round trip failed");
+ }
}
-
- $utf8_2 = fread($u, 10000);
- if ($utf8 != $utf8_2) {
- fatalError("round trip failed");
- }
-
dropTable($c, 'utf8test');
echo "Test succeeded\n";
diff --git a/test/functional/sqlsrv/MsHelper.inc b/test/functional/sqlsrv/MsHelper.inc
index 31c3bd86..988253b1 100644
--- a/test/functional/sqlsrv/MsHelper.inc
+++ b/test/functional/sqlsrv/MsHelper.inc
@@ -90,7 +90,8 @@ class ColumnMeta
{
$append = " ";
- if (isColEncrypted() && $this->encryptable) {
+ if ($this->encryptable && isDataEncrypted()) {
+
$cekName = getCekName();
if (stripos($this->dataType, "char") !== false) {
$append .= "COLLATE Latin1_General_BIN2 ";
@@ -325,13 +326,26 @@ function getSeqPlaceholders($num)
}
/**
- * @return bool false if $keystore specified in MsSetup.inc is none or data not encrypted,
- * otherwise return true
+ * @return bool false if $keystore specified in MsSetup.inc is none; return true otherwise
*/
function isColEncrypted()
{
global $keystore, $dataEncrypted;
- if ($keystore == KEYSTORE_NONE || !$dataEncrypted) {
+ if ($keystore === KEYSTORE_NONE) {
+ return false;
+ } else {
+ return true;
+ }
+}
+
+/**
+ * @return bool false if $keystore specified in MsSetup.inc is none or data not encrypted;
+ * return true otherwise
+ */
+function isDataEncrypted()
+{
+ global $keystore, $dataEncrypted;
+ if ($keystore === KEYSTORE_NONE || !$dataEncrypted) {
return false;
} else {
return true;
@@ -1065,6 +1079,23 @@ function getColName($k)
return ("");
}
+function isStreamData($k)
+{
+ switch ($k) {
+ case 14: return (true); // varchar(max)
+ case 17: return (true); // nvarchar(max)
+ case 18: return (true); // text
+ case 19: return (true); // ntext
+ case 20: return (true); // binary
+ case 21: return (true); // varbinary(512)
+ case 22: return (true); // varbinary(max)
+ case 23: return (true); // image
+ case 27: return (true); // timestamp
+ case 28: return (true); // xml
+ default: break;
+ }
+ return (false);
+}
function getColSize($k)
{
diff --git a/test/functional/sqlsrv/TC42_FetchField.phpt b/test/functional/sqlsrv/TC42_FetchField.phpt
index 462f95f6..b1395b5a 100644
--- a/test/functional/sqlsrv/TC42_FetchField.phpt
+++ b/test/functional/sqlsrv/TC42_FetchField.phpt
@@ -33,6 +33,9 @@ function fetchFields()
$stmt1 = AE\selectFromTable($conn1, $tableName);
$numFields = sqlsrv_num_fields($stmt1);
+ $errState = 'IMSSP';
+ $errMessage = 'Connection with Column Encryption enabled does not support fetching stream. Please fetch the data as a string.';
+
trace("Retrieving $noRowsInserted rows with $numFields fields each ...");
for ($i = 0; $i < $noRowsInserted; $i++) {
$row = sqlsrv_fetch($stmt1);
@@ -41,8 +44,16 @@ function fetchFields()
}
for ($j = 0; $j < $numFields; $j++) {
$fld = sqlsrv_get_field($stmt1, $j);
+
+ // With AE enabled, those fields that sqlsrv_get_field() will fetch
+ // as stream data will return a specific error message
+ $col = $j+1;
if ($fld === false) {
- fatalError("Field $j of Row $i is missing\n", true);
+ if (AE\isColEncrypted() && isStreamData($col)) {
+ verifyError(sqlsrv_errors()[0], $errState, $errMessage);
+ } else {
+ fatalError("Field $j of Row $i is missing\n", true);
+ }
}
}
}
diff --git a/test/functional/sqlsrv/TC51_StreamRead.phpt b/test/functional/sqlsrv/TC51_StreamRead.phpt
index 3e42243a..f81f2c82 100644
--- a/test/functional/sqlsrv/TC51_StreamRead.phpt
+++ b/test/functional/sqlsrv/TC51_StreamRead.phpt
@@ -69,7 +69,7 @@ function verifyStream($stmt, $row, $colIndex)
}
}
if ($stream === false) {
- fatalError("Failed to read field $col: $type");
+ verifyStreamError("Failed to read field $col: $type");
} else {
$value = '';
if ($stream) {
@@ -88,6 +88,15 @@ function verifyStream($stmt, $row, $colIndex)
}
}
+function verifyStreamError($message)
+{
+ global $errState, $errMessage;
+ if (AE\isColEncrypted()) {
+ verifyError(sqlsrv_errors()[0], $errState, $errMessage);
+ } else {
+ fatalError($message);
+ }
+}
function checkData($col, $actual, $expected)
{
@@ -123,6 +132,10 @@ if (!isWindows()) {
global $testName;
$testName = "Stream - Read";
+// error message expected with AE enabled
+$errState = 'IMSSP';
+$errMessage = 'Connection with Column Encryption enabled does not support fetching stream. Please fetch the data as a string.';
+
// test ansi only if windows or non-UTF8 locales are supported (ODBC 17 and above)
startTest($testName);
if (isWindows() || isLocaleSupported()) {
diff --git a/test/functional/sqlsrv/TC55_StreamScrollable.phpt b/test/functional/sqlsrv/TC55_StreamScrollable.phpt
index 82adc4b3..45d5a8a3 100644
--- a/test/functional/sqlsrv/TC55_StreamScrollable.phpt
+++ b/test/functional/sqlsrv/TC55_StreamScrollable.phpt
@@ -89,6 +89,16 @@ function streamScroll($noRows, $startRow)
sqlsrv_close($conn1);
}
+function verifyStreamError($message)
+{
+ global $errState, $errMessage;
+ if (AE\isColEncrypted()) {
+ verifyError(sqlsrv_errors()[0], $errState, $errMessage);
+ } else {
+ fatalError($message);
+ }
+}
+
function verifyStream($stmt, $row, $colIndex)
{
$col = $colIndex + 1;
@@ -104,7 +114,7 @@ function verifyStream($stmt, $row, $colIndex)
}
}
if ($stream === false) {
- fatalError("Failed to read field $col: $type");
+ verifyStreamError("Failed to read field $col: $type");
} else {
$value = '';
if ($stream) {
@@ -159,6 +169,10 @@ if (!isWindows()) {
global $testName;
$testName = "Stream - Scrollable";
+// error message expected with AE enabled
+$errState = 'IMSSP';
+$errMessage = 'Connection with Column Encryption enabled does not support fetching stream. Please fetch the data as a string.';
+
// test ansi only if windows or non-UTF8 locales are supported (ODBC 17 and above)
startTest($testName);
if (isWindows() || isLocaleSupported()) {
diff --git a/test/functional/sqlsrv/TC81_MemoryCheck.phpt b/test/functional/sqlsrv/TC81_MemoryCheck.phpt
index 1e9bbff8..fdd1702f 100644
--- a/test/functional/sqlsrv/TC81_MemoryCheck.phpt
+++ b/test/functional/sqlsrv/TC81_MemoryCheck.phpt
@@ -272,14 +272,23 @@ function runTest($noPasses, $noRows, $tableName, $conn, $prepared, $release, $mo
break;
case 5: // fetch fields
+ $errState = 'IMSSP';
+ $errMessage = 'Connection with Column Encryption enabled does not support fetching stream. Please fetch the data as a string.';
+
$stmt = execQuery($conn, $tableName, $prepared);
$numFields = sqlsrv_num_fields($stmt);
while (sqlsrv_fetch($stmt)) {
$rowCount++;
for ($i = 0; $i < $numFields; $i++) {
$fld = sqlsrv_get_field($stmt, $i);
+ $col = $i + 1;
+
if ($fld === false) {
- die("Field $i of row $rowCount is missing");
+ if (AE\isColEncrypted() && isStreamData($col)) {
+ verifyError(sqlsrv_errors()[0], $errState, $errMessage);
+ } else {
+ fatalError("Field $i of row $rowCount is missing");
+ }
}
unset($fld);
}
diff --git a/test/functional/sqlsrv/sqlsrv_ae_insert_money.phpt b/test/functional/sqlsrv/sqlsrv_ae_insert_money.phpt
index c1938460..2598ea15 100644
--- a/test/functional/sqlsrv/sqlsrv_ae_insert_money.phpt
+++ b/test/functional/sqlsrv/sqlsrv_ae_insert_money.phpt
@@ -28,7 +28,7 @@ foreach ($dataTypes as $dataType) {
$r;
$stmt = AE\insertRow($conn, $tbname, array( $colMetaArr[0]->colName => $inputValues[0], $colMetaArr[1]->colName => $inputValues[1] ), $r);
- if (!AE\isColEncrypted()) {
+ if (!AE\isDataEncrypted()) {
if ($r === false) {
echo "Default type should be compatible with $dataType.\n";
$success = false;
diff --git a/test/functional/sqlsrv/sqlsrv_ae_insert_retrieve.phpt b/test/functional/sqlsrv/sqlsrv_ae_insert_retrieve.phpt
index 6371bf5d..e88ef0df 100644
--- a/test/functional/sqlsrv/sqlsrv_ae_insert_retrieve.phpt
+++ b/test/functional/sqlsrv/sqlsrv_ae_insert_retrieve.phpt
@@ -44,7 +44,7 @@ sqlsrv_free_stmt($stmt);
//for AE only
echo "\nChecking ciphertext data:\n";
-if (AE\isColEncrypted()) {
+if (AE\isDataEncrypted()) {
$conn1 = connect(null, true);
$selectSql = "SELECT SSN, FirstName, LastName, BirthDate FROM $tbname";
$stmt = sqlsrv_query($conn1, $selectSql);
diff --git a/test/functional/sqlsrv/sqlsrv_ae_insert_retrieve_fixed_size.phpt b/test/functional/sqlsrv/sqlsrv_ae_insert_retrieve_fixed_size.phpt
index 22c7a4d2..d8c272ff 100644
--- a/test/functional/sqlsrv/sqlsrv_ae_insert_retrieve_fixed_size.phpt
+++ b/test/functional/sqlsrv/sqlsrv_ae_insert_retrieve_fixed_size.phpt
@@ -43,7 +43,7 @@ AE\fetchAll($conn, $tbname);
sqlsrv_free_stmt($stmt);
// for AE only
-if (AE\isColEncrypted()) {
+if (AE\isDataEncrypted()) {
$conn1 = connect(null, true);
$selectSql = "SELECT * FROM $tbname";
diff --git a/test/functional/sqlsrv/sqlsrv_ae_insert_retrieve_nvarchar.phpt b/test/functional/sqlsrv/sqlsrv_ae_insert_retrieve_nvarchar.phpt
index 54d42174..4003753b 100644
--- a/test/functional/sqlsrv/sqlsrv_ae_insert_retrieve_nvarchar.phpt
+++ b/test/functional/sqlsrv/sqlsrv_ae_insert_retrieve_nvarchar.phpt
@@ -14,7 +14,6 @@ $tbname = 'NVarcharAnalysis';
$colMetaArr = array( new AE\ColumnMeta("int", "CharCount", "IDENTITY(0,1)"), new AE\ColumnMeta("nvarchar(1000)"));
AE\createTable($conn, $tbname, $colMetaArr);
-
// insert 1000 rows
for ($i = 0; $i < 1000; $i++) {
$data = str_repeat("*", $i);
@@ -33,7 +32,7 @@ while ($decrypted_row = sqlsrv_fetch_array($stmt, SQLSRV_FETCH_ASSOC)) {
sqlsrv_free_stmt($stmt);
// for AE only
-if (AE\isColEncrypted()) {
+if (AE\isDataEncrypted()) {
$conn1 = connect(null, true);
$stmt = sqlsrv_query($conn1, $selectSql);
while ($encrypted_row = sqlsrv_fetch_array($stmt, SQLSRV_FETCH_ASSOC)) {
diff --git a/test/functional/sqlsrv/sqlsrv_ae_insert_retrieve_varchar.phpt b/test/functional/sqlsrv/sqlsrv_ae_insert_retrieve_varchar.phpt
index 29d8a329..6d28d35b 100644
--- a/test/functional/sqlsrv/sqlsrv_ae_insert_retrieve_varchar.phpt
+++ b/test/functional/sqlsrv/sqlsrv_ae_insert_retrieve_varchar.phpt
@@ -33,7 +33,7 @@ while ($decrypted_row = sqlsrv_fetch_array($stmt, SQLSRV_FETCH_ASSOC)) {
sqlsrv_free_stmt($stmt);
// for AE only
-if (AE\isColEncrypted()) {
+if (AE\isDataEncrypted()) {
$conn1 = connect(null, true);
$stmt = sqlsrv_query($conn1, $selectSql);
while ($encrypted_row = sqlsrv_fetch_array($stmt, SQLSRV_FETCH_ASSOC)) {
diff --git a/test/functional/sqlsrv/sqlsrv_ae_insert_sqltype_datetime.phpt b/test/functional/sqlsrv/sqlsrv_ae_insert_sqltype_datetime.phpt
index 353c7a67..021b937c 100644
--- a/test/functional/sqlsrv/sqlsrv_ae_insert_sqltype_datetime.phpt
+++ b/test/functional/sqlsrv/sqlsrv_ae_insert_sqltype_datetime.phpt
@@ -40,7 +40,7 @@ foreach ($dataTypes as $dataType) {
$r;
$stmt = AE\insertRow($conn, $tbname, array( $colMetaArr[0]->colName => $inputs[0], $colMetaArr[1]->colName => $inputs[1] ), $r, AE\INSERT_PREPARE_PARAMS);
- if (!AE\isColEncrypted()) {
+ if (!AE\isDataEncrypted()) {
if ($r === false) {
$isCompatible = false;
foreach ($compatList[$dataType] as $compatType) {
diff --git a/test/functional/sqlsrv/sqlsrv_ae_insert_sqltype_money.phpt b/test/functional/sqlsrv/sqlsrv_ae_insert_sqltype_money.phpt
index 88fcb409..35397c32 100644
--- a/test/functional/sqlsrv/sqlsrv_ae_insert_sqltype_money.phpt
+++ b/test/functional/sqlsrv/sqlsrv_ae_insert_sqltype_money.phpt
@@ -35,7 +35,7 @@ foreach ($dataTypes as $dataType) {
$r;
$stmt = AE\insertRow($conn, $tbname, array($colMetaArr[0]->colName => $inputs[0], $colMetaArr[1]->colName => $inputs[1]), $r, AE\INSERT_PREPARE_PARAMS);
- if (!AE\isColEncrypted()) {
+ if (!AE\isDataEncrypted()) {
if ($r === false) {
$isCompatible = false;
foreach ($compatList[$dataType] as $compatType) {
diff --git a/test/functional/sqlsrv/sqlsrv_ae_insert_sqltype_numeric.phpt b/test/functional/sqlsrv/sqlsrv_ae_insert_sqltype_numeric.phpt
index 1948e001..cb7aaf66 100644
--- a/test/functional/sqlsrv/sqlsrv_ae_insert_sqltype_numeric.phpt
+++ b/test/functional/sqlsrv/sqlsrv_ae_insert_sqltype_numeric.phpt
@@ -43,7 +43,7 @@ foreach ($dataTypes as $dataType) {
$r;
$stmt = AE\insertRow($conn, $tbname, array( $colMetaArr[0]->colName => $inputs[0], $colMetaArr[1]->colName => $inputs[1] ), $r, AE\INSERT_PREPARE_PARAMS);
- if (!AE\isColEncrypted()) {
+ if (!AE\isDataEncrypted()) {
if ($r === false) {
$isCompatible = false;
foreach ($compatList[$dataType] as $compatType) {
diff --git a/test/functional/sqlsrv/sqlsrv_prepare.phpt b/test/functional/sqlsrv/sqlsrv_prepare.phpt
index d4a96288..6bc742d1 100644
--- a/test/functional/sqlsrv/sqlsrv_prepare.phpt
+++ b/test/functional/sqlsrv/sqlsrv_prepare.phpt
@@ -76,9 +76,17 @@ binding parameters, including output parameters, using the simplified syntax.
$name = sqlsrv_get_field($stmt, 2, SQLSRV_PHPTYPE_STRING(SQLSRV_ENC_CHAR));
echo "$name\n";
$stream = sqlsrv_get_field($stmt, 3, SQLSRV_PHPTYPE_STREAM(SQLSRV_ENC_BINARY));
- while (!feof($stream)) {
- $str = fread($stream, 10000);
- echo $str;
+ if (!$stream) {
+ if (AE\isColEncrypted()) {
+ 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;
+ }
}
echo "\n";
}
@@ -121,14 +129,14 @@ binding parameters, including output parameters, using the simplified syntax.
sqlsrv_free_stmt($stmt);
sqlsrv_close($conn);
?>
---EXPECTF--
+--EXPECTREGEX--
1
-12.0
+12\.0
testtestte
-This is some text meant to test binding parameters to streams
+(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
+(This is some more text meant to test binding parameters to streams)?
3
4
diff --git a/test/functional/sqlsrv/sqlsrv_query.phpt b/test/functional/sqlsrv/sqlsrv_query.phpt
index 5727b9b8..5e3b1ce5 100644
--- a/test/functional/sqlsrv/sqlsrv_query.phpt
+++ b/test/functional/sqlsrv/sqlsrv_query.phpt
@@ -42,17 +42,25 @@ sqlsrv_query test. Performs same tasks as 0006.phpt, using sqlsrv_query.
while (sqlsrv_fetch($stmt)) {
$id = sqlsrv_get_field($stmt, 0, SQLSRV_PHPTYPE_STRING(SQLSRV_ENC_CHAR));
- echo "$id
";
+ echo "$id\n";
$double = sqlsrv_get_field($stmt, 1, SQLSRV_PHPTYPE_STRING(SQLSRV_ENC_CHAR));
- echo "$double
";
+ echo "$double\n";
$name = sqlsrv_get_field($stmt, 2, SQLSRV_PHPTYPE_STRING(SQLSRV_ENC_CHAR));
- echo "$name
";
+ echo "$name\n";
$stream = sqlsrv_get_field($stmt, 3, SQLSRV_PHPTYPE_STREAM(SQLSRV_ENC_BINARY));
- while (!feof($stream)) {
- $str = fread($stream, 4000);
- echo $str;
+ if (!$stream) {
+ if (AE\isColEncrypted()) {
+ echo sqlsrv_errors()[0]['message'];
+ } else {
+ fatalError('Fetching data stream failed!');
+ }
+ } else {
+ while (!feof($stream)) {
+ $str = fread($stream, 4000);
+ echo $str;
+ }
}
- echo "
";
+ echo "\n";
}
sqlsrv_query($conn, "DROP TABLE test_params");
@@ -61,5 +69,8 @@ sqlsrv_query test. Performs same tasks as 0006.phpt, using sqlsrv_query.
sqlsrv_close($conn);
?>
---EXPECTF--
-1
12.0
testtestte
This is some text meant to test binding parameters to streams
%A
+--EXPECTREGEX--
+1
+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.)
diff --git a/test/functional/sqlsrv/sqlsrv_send_stream_data.phpt b/test/functional/sqlsrv/sqlsrv_send_stream_data.phpt
index 3648f308..bb2cee6c 100644
--- a/test/functional/sqlsrv/sqlsrv_send_stream_data.phpt
+++ b/test/functional/sqlsrv/sqlsrv_send_stream_data.phpt
@@ -113,9 +113,17 @@ binding streams using full syntax.
$name = sqlsrv_get_field($stmt, 2, SQLSRV_PHPTYPE_STRING(SQLSRV_ENC_CHAR));
echo "$name\n";
$stream = sqlsrv_get_field($stmt, 3, SQLSRV_PHPTYPE_STREAM(SQLSRV_ENC_BINARY));
- while (!feof($stream)) {
- $str = fread($stream, 10000);
- echo $str;
+ if (!$stream) {
+ if (AE\isColEncrypted()) {
+ echo sqlsrv_errors()[0]['message'];
+ } else {
+ fatalError('Fetching data stream failed!');
+ }
+ } else {
+ while (!feof($stream)) {
+ $str = fread($stream, 10000);
+ echo $str;
+ }
}
echo "\n";
}
@@ -153,11 +161,11 @@ binding streams using full syntax.
dropTable($conn, $tableName);
sqlsrv_close($conn);
?>
---EXPECT--
-sqlsrv_query(2) failed.
-sqlsrv_query(3) failed.
+--EXPECTREGEX--
+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
+(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
\ No newline at end of file
diff --git a/test/functional/sqlsrv/srv_231_string_truncation_text.phpt b/test/functional/sqlsrv/srv_231_string_truncation_text.phpt
index 2e23c77b..2e62887d 100644
--- a/test/functional/sqlsrv/srv_231_string_truncation_text.phpt
+++ b/test/functional/sqlsrv/srv_231_string_truncation_text.phpt
@@ -47,6 +47,7 @@ function execProc($conn, $tableName, $columnNames, $k, $data, $sqlType)
$spCode = "SET @p2 = ( SELECT c2 FROM $tableName WHERE c1 = @p1 )";
$procName = "testBindOutSp";
+ dropProc($conn, $procName);
$stmt1 = sqlsrv_query($conn, "CREATE PROC [$procName] ($spArgs) AS BEGIN $spCode END");
sqlsrv_free_stmt($stmt1);
diff --git a/test/functional/sqlsrv/test_warning_errors3.phpt b/test/functional/sqlsrv/test_warning_errors3.phpt
index 308085c4..d949fb31 100644
--- a/test/functional/sqlsrv/test_warning_errors3.phpt
+++ b/test/functional/sqlsrv/test_warning_errors3.phpt
@@ -82,9 +82,19 @@ error messages when trying to retrieve past the end of a result set and when no
$name = sqlsrv_get_field($stmt, 2, SQLSRV_PHPTYPE_STRING(SQLSRV_ENC_CHAR));
echo "$name\n";
$stream = sqlsrv_get_field($stmt, 3, SQLSRV_PHPTYPE_STREAM(SQLSRV_ENC_BINARY));
- while (!feof($stream)) {
- $str = fread($stream, 10000);
- echo $str;
+ if (!$stream) {
+ if (AE\isColEncrypted()) {
+ 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);
+ if ($str !== "This is some text meant to test binding parameters to streams") {
+ fatalError("Incorrect data: \'$str\'!\n");
+ }
+ }
}
echo "\n";
}
@@ -127,11 +137,11 @@ Array
1
12.0
testtestte
-This is some text meant to test binding parameters to streams
+
2
13.0
testtestte
-This is some more text meant to test binding parameters to streams
+
Array
(
[0] => Array