Fixed emulate prepare test to run with always encrypted enabled (#1336)

This commit is contained in:
Jenny Tam 2021-11-29 15:17:08 -08:00 committed by GitHub
parent 64d96e6d18
commit 7f9099a35d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -41,23 +41,29 @@ EOF;
$st->execute();
$data = selectAll($cnn, $tbname);
var_dump($data);
$system_param = 'another string';
$system_param2 = 'another string';
$utf8_param = 'Привет';
$binary_param = fopen('php://memory', 'a');
fwrite($binary_param, hex2bin('80838790a9')); // testing some extended characters
rewind($binary_param);
$st->bindParam(1, $system_param, PDO::PARAM_STR);
$st->bindParam(1, $system_param2, PDO::PARAM_STR);
$st->bindParam(2, $utf8_param, PDO::PARAM_STR, 0, PDO::SQLSRV_ENCODING_UTF8);
$st->bindParam(3, $binary_param, PDO::PARAM_LOB, 0, PDO::SQLSRV_ENCODING_BINARY);
$st->execute();
$sql = "SELECT * FROM $tbname WHERE system_encoding = 'another string'";
$st = $cnn->query($sql);
$select = "SELECT * FROM $tbname WHERE system_encoding = ?";
$st = $cnn->prepare($select);
$st->bindParam(1, $system_param);
$st->execute();
$data = $st->fetchAll(PDO::FETCH_BOTH);
var_dump($data);
$st->bindParam(1, $system_param2);
$st->execute();
$st->bindColumn('utf8_encoding', $param2);
$st->bindColumn('binary_encoding', $param3);
$row = $st->fetch(PDO::FETCH_BOUND);