2017-04-21 22:04:24 +02:00
--TEST--
2017-04-21 23:57:57 +02:00
Tests error returned when binding input/output parameter with emulate prepare
2017-04-21 22:04:24 +02:00
--SKIPIF--
2017-11-30 23:37:25 +01:00
<?php require_once('skipif_mid-refactor.inc'); ?>
2017-04-21 22:04:24 +02:00
--FILE--
<?php
2017-11-30 23:37:25 +01:00
require_once("MsCommon_mid-refactor.inc");
2017-04-21 22:04:24 +02:00
try {
2017-11-30 23:37:25 +01:00
$dbh = connect();
2017-04-21 22:04:24 +02:00
2017-11-30 23:37:25 +01:00
$procName = 'sp_ReverseString';
dropProc($dbh, $procName);
$dbh->query("CREATE PROCEDURE $procName @String as VARCHAR(2048) OUTPUT as SELECT @String = REVERSE(@String)");
$stmt = $dbh->prepare("EXEC $procName ?", array(PDO::ATTR_EMULATE_PREPARES => true));
2017-04-21 22:04:24 +02:00
$string = "123456789";
$stmt->bindParam(1, $string, PDO::PARAM_STR | PDO::PARAM_INPUT_OUTPUT, 2048);
$stmt->execute();
2017-11-30 23:37:25 +01:00
print "Result: $string";
2017-04-21 22:04:24 +02:00
//free the statement and connection
2017-11-30 23:37:25 +01:00
dropProc($dbh, $procName);
unset($stmt);
unset($dbh);
} catch (PDOException $e) {
$error = $e->getMessage();
2017-12-06 01:32:18 +01:00
$pass = !isAEConnected() && $error === "SQLSTATE[IMSSP]: Statement with emulate prepare on does not support output or input_output parameters.";
$pass |= isAEConnected() && ($error === "SQLSTATE[IMSSP]: Parameterized statement with attribute PDO::ATTR_EMULATE_PREPARES is not supported in a Column Encryption enabled Connection.");
2017-11-30 23:37:25 +01:00
if (!$pass) {
print("Error: " . $error . "\n");
} else {
print("Test successfully done\n");
}
2017-04-21 22:04:24 +02:00
}
?>
--EXPECT--
2017-11-30 23:37:25 +01:00
Test successfully done