Merge pull request #627 from v-kaywon/fixPDOTests2
fix AE related tests
This commit is contained in:
commit
ef3601428b
|
@ -20,7 +20,7 @@ try {
|
||||||
|
|
||||||
echo "\n****testing with emulate prepare****\n";
|
echo "\n****testing with emulate prepare****\n";
|
||||||
// Do not support emulate prepare with Always Encrypted
|
// Do not support emulate prepare with Always Encrypted
|
||||||
if (!isColEncrypted()) {
|
if (!isAEConnected()) {
|
||||||
$stmt = $conn->prepare("SELECT c2 FROM $tbname WHERE c1= :int", array(PDO::ATTR_EMULATE_PREPARES => true));
|
$stmt = $conn->prepare("SELECT c2 FROM $tbname WHERE c1= :int", array(PDO::ATTR_EMULATE_PREPARES => true));
|
||||||
} else {
|
} else {
|
||||||
$stmt = $conn->prepare("SELECT c2 FROM $tbname WHERE c1= :int");
|
$stmt = $conn->prepare("SELECT c2 FROM $tbname WHERE c1= :int");
|
||||||
|
@ -32,7 +32,7 @@ try {
|
||||||
$stmt->execute();
|
$stmt->execute();
|
||||||
|
|
||||||
$stmt_error = $stmt->errorInfo();
|
$stmt_error = $stmt->errorInfo();
|
||||||
if (!isColEncrypted()) {
|
if (!isAEConnected()) {
|
||||||
if ($stmt_error[0] != "HY093") {
|
if ($stmt_error[0] != "HY093") {
|
||||||
echo "SQLSTATE should be HY093 when Emulate Prepare is true.\n";
|
echo "SQLSTATE should be HY093 when Emulate Prepare is true.\n";
|
||||||
print_r($stmt_error);
|
print_r($stmt_error);
|
||||||
|
|
|
@ -22,7 +22,7 @@ function testReverse($conn)
|
||||||
$stmt->execute();
|
$stmt->execute();
|
||||||
// Connection with Column Encryption enabled works for non encrypted SQL_VARIANT
|
// Connection with Column Encryption enabled works for non encrypted SQL_VARIANT
|
||||||
// Since SQLDescribeParam is called
|
// Since SQLDescribeParam is called
|
||||||
if (isColEncrypted() && $string === "987654321") {
|
if (isAEConnected() && $string === "987654321") {
|
||||||
echo "Testing input output parameter with SQL_VARIANT is successful.\n";
|
echo "Testing input output parameter with SQL_VARIANT is successful.\n";
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
@ -31,7 +31,7 @@ function testReverse($conn)
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
//echo "Failed when calling the reverse procedure\n";
|
//echo "Failed when calling the reverse procedure\n";
|
||||||
$error = $e->getMessage();
|
$error = $e->getMessage();
|
||||||
if (!isColEncrypted() && strpos($error, "Implicit conversion from data type sql_variant to nvarchar is not allowed.") !== false) {
|
if (!isAEConnected() && strpos($error, "Implicit conversion from data type sql_variant to nvarchar is not allowed.") !== false) {
|
||||||
echo "Testing input output parameter with SQL_VARIANT is successful.\n";
|
echo "Testing input output parameter with SQL_VARIANT is successful.\n";
|
||||||
} else {
|
} else {
|
||||||
echo "$error\n";
|
echo "$error\n";
|
||||||
|
@ -47,7 +47,7 @@ function createVariantTable($conn, $tableName)
|
||||||
echo $e->getMessage();
|
echo $e->getMessage();
|
||||||
}
|
}
|
||||||
$data = "This is to test if sql_variant works with output parameters";
|
$data = "This is to test if sql_variant works with output parameters";
|
||||||
if (!isColEncrypted()) {
|
if (!isAEConnected()) {
|
||||||
$tsql = "INSERT INTO [$tableName] ([c1_int], [c2_variant]) VALUES (1, ?)";
|
$tsql = "INSERT INTO [$tableName] ([c1_int], [c2_variant]) VALUES (1, ?)";
|
||||||
$stmt = $conn->prepare($tsql);
|
$stmt = $conn->prepare($tsql);
|
||||||
$result = $stmt->execute(array($data));
|
$result = $stmt->execute(array($data));
|
||||||
|
@ -78,7 +78,7 @@ function testOutputParam($conn, $tableName)
|
||||||
$stmt->bindValue(1, 1);
|
$stmt->bindValue(1, 1);
|
||||||
$stmt->bindParam(2, $callResult, PDO::PARAM_STR, 100);
|
$stmt->bindParam(2, $callResult, PDO::PARAM_STR, 100);
|
||||||
$stmt->execute();
|
$stmt->execute();
|
||||||
if (isColEncrypted() && $callResult === "This is to test if sql_variant works with output parameters") {
|
if (isAEConnected() && $callResult === "This is to test if sql_variant works with output parameters") {
|
||||||
echo "Testing output parameter with SQL_VARIANT is successful.\n";
|
echo "Testing output parameter with SQL_VARIANT is successful.\n";
|
||||||
} else {
|
} else {
|
||||||
echo "Does SELECT from table work? $callResult \n";
|
echo "Does SELECT from table work? $callResult \n";
|
||||||
|
@ -88,7 +88,7 @@ function testOutputParam($conn, $tableName)
|
||||||
echo "initialized data and result should be the same";
|
echo "initialized data and result should be the same";
|
||||||
}
|
}
|
||||||
$error = $e->getMessage();
|
$error = $e->getMessage();
|
||||||
if (!isColEncrypted() && strpos($error, "Operand type clash: nvarchar(max) is incompatible with sql_variant") !== false) {
|
if (!isAEConnected() && strpos($error, "Operand type clash: nvarchar(max) is incompatible with sql_variant") !== false) {
|
||||||
echo "Testing output parameter with SQL_VARIANT is successful.\n";
|
echo "Testing output parameter with SQL_VARIANT is successful.\n";
|
||||||
} else {
|
} else {
|
||||||
echo "$error\n";
|
echo "$error\n";
|
||||||
|
|
Loading…
Reference in a new issue