Skip to content
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

Modified pdo tests to work with column encryption #1051

Merged
merged 1 commit into from
Nov 6, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,18 @@ try {

echo "Done\n";
} catch (PdoException $e) {
echo $e->getMessage() . PHP_EOL;
if (isAEConnected()) {
// The Always Encrypted feature does not support emulate prepare for binding parameters
$expected = '*Parameterized statement with attribute PDO::ATTR_EMULATE_PREPARES is not supported in a Column Encryption enabled Connection.';
if (!fnmatch($expected, $e->getMessage())) {
echo "Unexpected exception caught when connecting with Column Encryption enabled:\n";
echo $e->getMessage() . PHP_EOL;
} else {
echo "Done\n";
}
} else {
echo $e->getMessage() . PHP_EOL;
}
}

?>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ function insertRead($conn, $pdoStrParam, $value, $testCase, $id, $encoding = fal
{
global $p, $tableName;

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

Expand Down