Skip to content

Commit

Permalink
Modified pdo tests to work with column encryption (#1051)
Browse files Browse the repository at this point in the history
  • Loading branch information
yitam authored Nov 6, 2019
1 parent 0513287 commit e30752f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
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

0 comments on commit e30752f

Please sign in to comment.