зеркало из https://github.com/microsoft/msphpsql.git
Modified to check if qualified for AE connections (#967)
This commit is contained in:
Родитель
8ba932b1ca
Коммит
1e4f014727
|
@ -12,6 +12,17 @@ require_once("MsSetup.inc");
|
|||
require_once("MsCommon_mid-refactor.inc");
|
||||
|
||||
try {
|
||||
// This test requires to connect with the Always Encrypted feature
|
||||
// First check if the system is qualified to run this test
|
||||
$dsn = getDSN($server, null);
|
||||
$conn = new PDO($dsn, $uid, $pwd);
|
||||
if (!isAEQualified($conn)) {
|
||||
echo "Done\n";
|
||||
return;
|
||||
}
|
||||
unset($conn);
|
||||
|
||||
// Now connect with ColumnEncryption enabled
|
||||
$connectionInfo = "ColumnEncryption = Enabled;";
|
||||
$conn = new PDO("sqlsrv:server = $server; database=$databaseName; $connectionInfo", $uid, $pwd);
|
||||
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
||||
|
|
|
@ -19,7 +19,22 @@ function verifyFetchError()
|
|||
|
||||
require_once('MsCommon.inc');
|
||||
|
||||
$connectionOptions = array("Database" => $database, "UID" => $userName, "PWD" => $userPassword, "ColumnEncryption" => "Enabled");
|
||||
// This test requires to connect with the Always Encrypted feature
|
||||
// First check if the system is qualified to run this test
|
||||
$options = array("Database" => $database, "UID" => $userName, "PWD" => $userPassword);
|
||||
$conn = sqlsrv_connect($server, $options);
|
||||
if ($conn === false) {
|
||||
fatalError("Failed to connect to $server.");
|
||||
}
|
||||
|
||||
if (!AE\isQualified($conn)) {
|
||||
echo "Done\n";
|
||||
return;
|
||||
}
|
||||
sqlsrv_close($conn);
|
||||
|
||||
// Now connect with ColumnEncryption enabled
|
||||
$connectionOptions = array_merge($options, array('ColumnEncryption' => 'Enabled'));
|
||||
$conn = sqlsrv_connect($server, $connectionOptions);
|
||||
if ($conn === false) {
|
||||
fatalError("Failed to connect to $server.");
|
||||
|
|
Загрузка…
Ссылка в новой задаче