From e30752fc6c23fc33b779dca403b8c28b48cb199f Mon Sep 17 00:00:00 2001 From: Jenny Tam Date: Wed, 6 Nov 2019 08:21:38 -0800 Subject: [PATCH] Modified pdo tests to work with column encryption (#1051) --- .../pdo_1018_emulate_prepare_natl_char.phpt | 13 ++++++++++++- .../pdo_sqlsrv/pdo_1018_real_prepare_natl_char.phpt | 2 +- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/test/functional/pdo_sqlsrv/pdo_1018_emulate_prepare_natl_char.phpt b/test/functional/pdo_sqlsrv/pdo_1018_emulate_prepare_natl_char.phpt index 5c389bb9f..02d37c204 100644 --- a/test/functional/pdo_sqlsrv/pdo_1018_emulate_prepare_natl_char.phpt +++ b/test/functional/pdo_sqlsrv/pdo_1018_emulate_prepare_natl_char.phpt @@ -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; + } } ?> diff --git a/test/functional/pdo_sqlsrv/pdo_1018_real_prepare_natl_char.phpt b/test/functional/pdo_sqlsrv/pdo_1018_real_prepare_natl_char.phpt index e058994e5..9ee0dcceb 100644 --- a/test/functional/pdo_sqlsrv/pdo_1018_real_prepare_natl_char.phpt +++ b/test/functional/pdo_sqlsrv/pdo_1018_real_prepare_natl_char.phpt @@ -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);