diff --git a/test/functional/pdo_sqlsrv/PDO12_Info.phpt b/test/functional/pdo_sqlsrv/PDO12_Info.phpt index dd9acb16..18deeb74 100644 --- a/test/functional/pdo_sqlsrv/PDO12_Info.phpt +++ b/test/functional/pdo_sqlsrv/PDO12_Info.phpt @@ -18,7 +18,7 @@ try { if (stristr($info, "PDO support => enabled") === false) { printf("PDO is not enabled\n"); } elseif (stristr($info, "pdo_sqlsrv support => enabled") === false) { - printf("Cannot find PDO driver line in phpinfo() output\n"); + printf("Cannot find PDO_SQLSRV driver in phpinfo() output\n"); } else { printf("Done\n"); } diff --git a/test/functional/pdo_sqlsrv/PDO24_ErrorCode.phpt b/test/functional/pdo_sqlsrv/PDO24_ErrorCode.phpt index 3d80869d..57ac55d0 100644 --- a/test/functional/pdo_sqlsrv/PDO24_ErrorCode.phpt +++ b/test/functional/pdo_sqlsrv/PDO24_ErrorCode.phpt @@ -11,7 +11,7 @@ PHPT_EXEC=true require_once("MsCommon_mid-refactor.inc"); try { $conn1 = connect(); - checkError(1, $conn1, '00000'); + checkError(1, $conn1); // Prepare test table $table1 = "Table1"; @@ -37,10 +37,11 @@ try { echo $e->getMessage(); } -function checkError($offset, &$obj, $expected = '00000') +function checkError($offset, &$obj) { $code = $obj->errorCode(); - if (($code != $expected) && (($expected != '00000') || ($code !=''))) { + $expected = '00000'; + if ($code != $expected && !empty($code)) { printf("[%03d] Expecting error code '%s' got code '%s'\n", $offset, $expected, $code); } } diff --git a/test/functional/pdo_sqlsrv/PDO25_ErrorInfo.phpt b/test/functional/pdo_sqlsrv/PDO25_ErrorInfo.phpt index ef5da345..6d16ed40 100644 --- a/test/functional/pdo_sqlsrv/PDO25_ErrorInfo.phpt +++ b/test/functional/pdo_sqlsrv/PDO25_ErrorInfo.phpt @@ -29,7 +29,7 @@ try { $stmt1->closeCursor(); dropTable($conn1, $table1); - $stmt1->execute(); + @$stmt1->execute(); checkError(5, $conn1); checkError(6, $stmt1, '42S02'); checkError(7, $stmt2, '42S02'); @@ -76,7 +76,7 @@ function checkError($offset, &$obj, $expected = '00000') printf("[%03d] Driver-specific error code not set\n", $offset); } if (!isset($info[2]) || ($info[2] == '')) { - printf("[%03d] Driver-specific error message.not set\n", $offset); + printf("[%03d] Driver-specific error message not set\n", $offset); } } } diff --git a/test/functional/pdo_sqlsrv/break_pdo.php b/test/functional/pdo_sqlsrv/break_pdo.php index d1aa4e9e..c5287a33 100644 --- a/test/functional/pdo_sqlsrv/break_pdo.php +++ b/test/functional/pdo_sqlsrv/break_pdo.php @@ -14,38 +14,39 @@ $tableName2 = "test_connres2"; // from AppVeyor does not have AdventureWorks. function generateTables($server, $uid, $pwd, $dbName, $tableName1, $tableName2) { - $conn = new PDO("sqlsrv:server = $server ; Database = $dbName ;", $uid, $pwd); - if ($conn === false) { - die(print_r(sqlsrv_errors())); + try { + $conn = new PDO("sqlsrv:server = $server ; Database = $dbName ;", $uid, $pwd); + + // Create table + $sql = "CREATE TABLE $tableName1 (c1 INT, c2 VARCHAR(40))"; + $stmt = $conn->query($sql); + + // Insert data + $sql = "INSERT INTO $tableName1 VALUES ( ?, ? )"; + for ($t = 100; $t < 116; $t++) { + $stmt = $conn->prepare($sql); + $ts = substr(sha1($t), 0, 5); + $params = array( $t,$ts ); + $stmt->execute($params); + } + + // Create table + $sql = "CREATE TABLE $tableName2 ( c1 INT, c2 VARCHAR(40) )"; + $stmt = $conn->query($sql); + + // Insert data + $sql = "INSERT INTO $tableName2 VALUES ( ?, ? )"; + for ($t = 200; $t < 209; $t++) { + $stmt = $conn->prepare($sql); + $ts = substr(sha1($t), 0, 5); + $params = array( $t,$ts ); + $stmt->execute($params); + } + + unset($conn); + } catch (PDOException $e) { + var_dump($e->errorInfo); } - - // Create table - $sql = "CREATE TABLE $tableName1 ( c1 INT, c2 VARCHAR(40) )"; - $stmt = $conn->query($sql); - - // Insert data - $sql = "INSERT INTO $tableName1 VALUES ( ?, ? )"; - for ($t = 100; $t < 116; $t++) { - $stmt = $conn->prepare($sql); - $ts = substr(sha1($t), 0, 5); - $params = array( $t,$ts ); - $stmt->execute($params); - } - - // Create table - $sql = "CREATE TABLE $tableName2 ( c1 INT, c2 VARCHAR(40) )"; - $stmt = $conn->query($sql); - - // Insert data - $sql = "INSERT INTO $tableName2 VALUES ( ?, ? )"; - for ($t = 200; $t < 209; $t++) { - $stmt = $conn->prepare($sql); - $ts = substr(sha1($t), 0, 5); - $params = array( $t,$ts ); - $stmt->execute($params); - } - - $conn = null; } // Break connection by getting the session ID and killing it. diff --git a/test/functional/pdo_sqlsrv/pdo_connection_resiliency.phpt b/test/functional/pdo_sqlsrv/pdo_connection_resiliency.phpt index cb4201c4..6c2adeec 100644 --- a/test/functional/pdo_sqlsrv/pdo_connection_resiliency.phpt +++ b/test/functional/pdo_sqlsrv/pdo_connection_resiliency.phpt @@ -31,6 +31,8 @@ $conn_break = connect(); $connectionInfo = "ConnectRetryCount = 10; ConnectRetryInterval = 10;"; try { + // TODO: Idle connection resiliency does not work with Column Encryption at this point + // Do not connect with ColumnEncryption for now $conn = connect($connectionInfo, array(), PDO::ERRMODE_EXCEPTION, true); } catch (PDOException $e) { echo "Could not connect.\n"; diff --git a/test/functional/pdo_sqlsrv/pdo_error.phpt b/test/functional/pdo_sqlsrv/pdo_error.phpt index 6272df3e..65ddce7e 100644 --- a/test/functional/pdo_sqlsrv/pdo_error.phpt +++ b/test/functional/pdo_sqlsrv/pdo_error.phpt @@ -12,7 +12,7 @@ try { $tbname = "PDO_MainTypes"; createTableMainTypes($db, $tbname); // query with a wrong column name. - $db->query("Select * from " . $tbname . " where IntColX = 1"); + $db->query("SELECT * FROM $tbname WHERE IntColX = 1"); dropTable($db, $tbname); unset($conn);