Skip to content

Commit e30752f

Browse files
authored
Modified pdo tests to work with column encryption (#1051)
1 parent 0513287 commit e30752f

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

test/functional/pdo_sqlsrv/pdo_1018_emulate_prepare_natl_char.phpt

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,18 @@ try {
101101

102102
echo "Done\n";
103103
} catch (PdoException $e) {
104-
echo $e->getMessage() . PHP_EOL;
104+
if (isAEConnected()) {
105+
// The Always Encrypted feature does not support emulate prepare for binding parameters
106+
$expected = '*Parameterized statement with attribute PDO::ATTR_EMULATE_PREPARES is not supported in a Column Encryption enabled Connection.';
107+
if (!fnmatch($expected, $e->getMessage())) {
108+
echo "Unexpected exception caught when connecting with Column Encryption enabled:\n";
109+
echo $e->getMessage() . PHP_EOL;
110+
} else {
111+
echo "Done\n";
112+
}
113+
} else {
114+
echo $e->getMessage() . PHP_EOL;
115+
}
105116
}
106117

107118
?>

test/functional/pdo_sqlsrv/pdo_1018_real_prepare_natl_char.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ function insertRead($conn, $pdoStrParam, $value, $testCase, $id, $encoding = fal
2222
{
2323
global $p, $tableName;
2424

25-
$sql = "INSERT INTO $tableName VALUES (:value)";
25+
$sql = "INSERT INTO $tableName (Col1) VALUES (:value)";
2626
$options = array(PDO::ATTR_EMULATE_PREPARES => false); // it's false by default anyway
2727
$stmt = $conn->prepare($sql, $options);
2828

0 commit comments

Comments
 (0)