diff --git a/test/functional/pdo_sqlsrv/PDO100_InsertNulls.phpt b/test/functional/pdo_sqlsrv/PDO100_InsertNulls.phpt index b450e4bf..97d712e7 100644 --- a/test/functional/pdo_sqlsrv/PDO100_InsertNulls.phpt +++ b/test/functional/pdo_sqlsrv/PDO100_InsertNulls.phpt @@ -14,10 +14,10 @@ function insertNullsTest($bindType) { $outvar = null; $failed = false; - $conn =connect(); + $conn = connect(); $tableName = "pdo_test_table"; - $dataType = array("c1_int" => "int", + $dataTypes = array("c1_int" => "int", "c2_tinyint" => "tinyint", "c3_smallint" => "smallint", "c4_bigint" => "bigint", @@ -45,12 +45,12 @@ function insertNullsTest($bindType) "c26_smalldatetime" => "smalldatetime", "c27_timestamp" => "timestamp", "c28_xml" => "xml"); - createTable($conn, $tableName, $dataType); + createTable($conn, $tableName, $dataTypes); $stmt = $conn->query("SELECT [TABLE_NAME],[COLUMN_NAME],[IS_NULLABLE] FROM [INFORMATION_SCHEMA].[COLUMNS] WHERE [TABLE_NAME] = '$tableName'"); if ($stmt === false) { - FatalError("Could not query for column information on table $tableName"); + fatalError("Could not query for column information on table $tableName"); } while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) { @@ -98,7 +98,7 @@ try { echo $e->getMessage(); } if ($failed) { - FatalError("Possible Regression: Could not insert NULL"); + fatalError("Possible Regression: Could not insert NULL"); } else { echo "Test 'PDO - Insert Nulls' completed successfully.\n"; } diff --git a/test/functional/pdo_sqlsrv/PDO102_MaxOutputParams.phpt b/test/functional/pdo_sqlsrv/PDO102_MaxOutputParams.phpt index 67ef5cbf..721c66b9 100644 --- a/test/functional/pdo_sqlsrv/PDO102_MaxOutputParams.phpt +++ b/test/functional/pdo_sqlsrv/PDO102_MaxOutputParams.phpt @@ -27,13 +27,12 @@ function maxOutputParamsTest($expected, $length) echo "Expected: $expected Received: $outstr\n"; + $failed = false; if ($outstr !== $expected) { print_r($stmt->errorInfo()); - dropProc($conn, $procName); - return(-1); + $failed = true; } - dropProc($conn, $procName); - return(0); + return $failed; } @@ -41,13 +40,13 @@ function maxOutputParamsTest($expected, $length) // Repro // //-------------------------------------------------------------------- -$failed = null; +$failed = false; $failed |= maxOutputParamsTest("abc", 3); $failed |= maxOutputParamsTest("abc", 10); if ($failed) { - FatalError("Possible Regression: Value returned as VARCHAR(MAX) truncated"); + fatalError("Possible Regression: Value returned as VARCHAR(MAX) truncated"); } ?> --EXPECT-- diff --git a/test/functional/pdo_sqlsrv/PDO38_FetchBound.phpt b/test/functional/pdo_sqlsrv/PDO38_FetchBound.phpt index e241a8a3..2885916a 100644 --- a/test/functional/pdo_sqlsrv/PDO38_FetchBound.phpt +++ b/test/functional/pdo_sqlsrv/PDO38_FetchBound.phpt @@ -24,14 +24,14 @@ try { array('60', 'Pqr', 'kji')); // Insert using question mark placeholders - $stmt1 = PrepareQuery($conn1, "INSERT INTO [$tableName] VALUES(?, ?, ?)"); + $stmt1 = $conn1->prepare("INSERT INTO [$tableName] VALUES(?, ?, ?)"); foreach ($data as $row) { $stmt1->execute($row); } unset($stmt1); // Count inserted rows - $stmt2 = PrepareQuery($conn1, "SELECT COUNT(id) FROM [$tableName]"); + $stmt2 = $conn1->prepare("SELECT COUNT(id) FROM [$tableName]"); $stmt2->execute(); $num = $stmt2->fetchColumn(); echo "There are $num rows in the table.\n"; @@ -60,13 +60,14 @@ try { unset($stmt1); if (!isColEncrypted()) { - $stmt1 = PrepareQuery($conn1, "SELECT idx, txt FROM [$tableName] ORDER BY idx"); + $stmt1 = $conn1->prepare("SELECT idx, txt FROM [$tableName] ORDER BY idx"); } else { // ORDER BY does not work on encrypted columns - $stmt1 = PrepareQuery($conn1, "SELECT idx, txt FROM [$tableName]"); + $stmt1 = $conn1->prepare("SELECT idx, txt FROM [$tableName]"); } $stmt1->execute(); $data = $stmt1->fetchAll(PDO::FETCH_COLUMN|PDO::FETCH_UNIQUE); + // needs to order the result set manually as ORDER BY does not work properly on encrypted columns if (isColEncrypted()) { ksort($data); } @@ -99,50 +100,50 @@ try { var_dump($stmt2->execute()); if ($idx == 0) { // bindColumn()s after execute() has been called at least once - $stmt2->bindColumn('txt', $col1); + $stmt2->bindColumn('txt', $txtCol); } var_dump($stmt2->fetch(PDO::FETCH_BOUND)); $stmt2->closeCursor(); var_dump($stmt3->execute()); if ($idx == 0) { // bindColumn()s after execute() has been called at least once - $stmt3->bindColumn('idx', $col2); + $stmt3->bindColumn('idx', $idxCol); } var_dump($stmt3->fetch(PDO::FETCH_BOUND)); $stmt3->closeCursor(); - var_dump(array($col2=>$col1)); + var_dump(array($idxCol=>$txtCol)); } echo "===REBIND/SAME===\n"; - $stmt3->bindColumn('idx', $col1); + $stmt3->bindColumn('idx', $idxCol); foreach ($data as $idx => $txt) { var_dump(array($idx=>$txt)); var_dump($stmt2->execute()); var_dump($stmt2->fetch(PDO::FETCH_BOUND)); $stmt2->closeCursor(); - var_dump($col1); + var_dump($idxCol); var_dump($stmt3->execute()); var_dump($stmt3->fetch(PDO::FETCH_BOUND)); $stmt3->closeCursor(); - var_dump($col1); + var_dump($idxCol); } echo "===REBIND/CONFLICT===\n"; - $stmt1->bindColumn('idx', $col1); - $stmt1->bindColumn('txt', $col1); + $stmt1->bindColumn('idx', $col); + $stmt1->bindColumn('txt', $col); $stmt1->execute(); - $col1s = array(); + $cols = array(); while ($stmt1->fetch(PDO::FETCH_BOUND)) { - array_push($col1s, $col1); + array_push($cols, $col); } if (isColEncrypted()) { - sort($col1s); + sort($cols); } - var_dump($col1s); + var_dump($cols); // Cleanup dropTable($conn1, $tableName); diff --git a/test/functional/pdo_sqlsrv/pdoStatement_bindParam_inout_emulate_prepare.phpt b/test/functional/pdo_sqlsrv/pdoStatement_bindParam_inout_emulate_prepare.phpt index 1ddd0eea..677ebe14 100644 --- a/test/functional/pdo_sqlsrv/pdoStatement_bindParam_inout_emulate_prepare.phpt +++ b/test/functional/pdo_sqlsrv/pdoStatement_bindParam_inout_emulate_prepare.phpt @@ -23,8 +23,8 @@ try { unset($dbh); } catch (PDOException $e) { $error = $e->getMessage(); - $pass = !isColEncrypted() && $error === "SQLSTATE[IMSSP]: Statement with emulate prepare on does not support output or input_output parameters."; - $pass |= isColEncrypted() && ($error === "SQLSTATE[IMSSP]: Connection with Column Encryption enabled do no support PDO::ATTR_EMULATE_PREPARES with binding parameters."); + $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."); if (!$pass) { print("Error: " . $error . "\n"); } else { diff --git a/test/functional/pdo_sqlsrv/pdo_prepare_attribute.phpt b/test/functional/pdo_sqlsrv/pdo_prepare_attribute.phpt index ef702bf6..6f4b5f45 100644 --- a/test/functional/pdo_sqlsrv/pdo_prepare_attribute.phpt +++ b/test/functional/pdo_sqlsrv/pdo_prepare_attribute.phpt @@ -40,7 +40,7 @@ if (!$exception_thrown) { // Column encryption is not supported by emulate prepared statement $option[PDO::ATTR_EMULATE_PREPARES] = true; -if (isColEncrypted()) { +if (isAEConnected()) { $option[PDO::ATTR_EMULATE_PREPARES] = false; } diff --git a/test/functional/pdo_sqlsrv/pdostatement_fetchmode_emulate_prepare.phpt b/test/functional/pdo_sqlsrv/pdostatement_fetchmode_emulate_prepare.phpt index e7da69c6..f8d1e0b9 100644 --- a/test/functional/pdo_sqlsrv/pdostatement_fetchmode_emulate_prepare.phpt +++ b/test/functional/pdo_sqlsrv/pdostatement_fetchmode_emulate_prepare.phpt @@ -47,7 +47,7 @@ try { } $query1 = "INSERT INTO [$tableName](ID, Policy, Label, Budget) VALUES (:col1, :col2, :col3, :col4)"; - if (!isColEncrypted()) { + if (!isAEConnected()) { $stmtOptions[PDO::ATTR_EMULATE_PREPARES] = true; } $stmt = $conn1->prepare($query1, $stmtOptions); diff --git a/test/functional/pdo_sqlsrv/test_encoding_UTF8_emulate_prepare.phpt b/test/functional/pdo_sqlsrv/test_encoding_UTF8_emulate_prepare.phpt index e9137afe..0b790437 100644 --- a/test/functional/pdo_sqlsrv/test_encoding_UTF8_emulate_prepare.phpt +++ b/test/functional/pdo_sqlsrv/test_encoding_UTF8_emulate_prepare.phpt @@ -53,7 +53,7 @@ try { unset($stmt4); $option; - if (!isColEncrypted()) { + if (!isAEConnected()) { $option[PDO::ATTR_EMULATE_PREPARES] = true; } else { $option[PDO::ATTR_EMULATE_PREPARES] = false;