Skip to content

Commit

Permalink
Fixed emulate prepare test to run with always encrypted enabled (#1336)
Browse files Browse the repository at this point in the history
  • Loading branch information
yitam authored Nov 29, 2021
1 parent 64d96e6 commit 7f9099a
Showing 1 changed file with 13 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 7f9099a

Please sign in to comment.