diff --git a/test/functional/pdo_sqlsrv/pdo_018_next_result_set.phpt b/test/functional/pdo_sqlsrv/pdo_018_next_result_set.phpt index ea48f279..b8849aa7 100644 --- a/test/functional/pdo_sqlsrv/pdo_018_next_result_set.phpt +++ b/test/functional/pdo_sqlsrv/pdo_018_next_result_set.phpt @@ -75,7 +75,7 @@ try { } // Close connection - //dropTable($conn, $tableName); + dropTable($conn, $tableName); unset($stmt); unset($con); diff --git a/test/functional/pdo_sqlsrv/pdo_033_binary_unicode.phpt b/test/functional/pdo_sqlsrv/pdo_033_binary_unicode.phpt index d20b7f76..04462ee4 100644 --- a/test/functional/pdo_sqlsrv/pdo_033_binary_unicode.phpt +++ b/test/functional/pdo_sqlsrv/pdo_033_binary_unicode.phpt @@ -1,7 +1,7 @@ --TEST-- Insert binary HEX data then fetch it back as string --DESCRIPTION-- -Insert binary HEX data into an nvarchar field then read it back as UTF-8 string +Insert binary HEX data into an nvarchar field then read it back as UTF-8 string --SKIPIF-- --FILE-- @@ -16,12 +16,15 @@ try { $tableName = 'pdo_033test'; createTable($conn, $tableName, array("c1" => "nvarchar(100)")); - $input = pack( "H*", '49006427500048005000' ); // I'LOVE_SYMBOL'PHP + $input = pack("H*", '49006427500048005000'); // I'LOVE_SYMBOL'PHP $result; $stmt = insertRow($conn, $tableName, array("c1" => new BindParamOp(1, $input, "PDO::PARAM_STR", 0, "PDO::SQLSRV_ENCODING_BINARY")), "prepareBindParam", $result); - + if (!$result) { echo "Failed to insert!\n"; + dropTable($conn, $tableName); + unset($stmt); + unset($conn); exit; } @@ -36,10 +39,10 @@ try { } catch (PDOException $e) { var_dump($e->errorInfo); } - + print "Done"; ?> --EXPECT-- I❤PHP -Done \ No newline at end of file +Done diff --git a/test/functional/pdo_sqlsrv/pdo_040_error_information.phpt b/test/functional/pdo_sqlsrv/pdo_040_error_information.phpt index 4081505d..9de1bcd5 100644 --- a/test/functional/pdo_sqlsrv/pdo_040_error_information.phpt +++ b/test/functional/pdo_sqlsrv/pdo_040_error_information.phpt @@ -9,7 +9,7 @@ require_once("MsCommon_mid-refactor.inc"); try { // Connect // set errmode to silent to compare sqlstates in the test - $conn = connect("", array(), "silent"); + $conn = connect("", array(), PDO::ERRMODE_SILENT); // Create table $tableName = 'pdo_040test'; diff --git a/test/functional/pdo_sqlsrv/pdo_065_construct_persistent.phpt b/test/functional/pdo_sqlsrv/pdo_065_construct_persistent.phpt index 58bc4a73..883da029 100644 --- a/test/functional/pdo_sqlsrv/pdo_065_construct_persistent.phpt +++ b/test/functional/pdo_sqlsrv/pdo_065_construct_persistent.phpt @@ -5,6 +5,7 @@ Exception is thrown if the unsupported attribute ATTR_PERSISTENT is put into the --FILE-- true); $conn = new PDO($dsn, $uid, $pwd, $attr); - //free the connection unset($conn); } catch (PDOException $e) { echo "Exception from unsupported attribute (ATTR_PERSISTENT) is caught\n"; } try { - require_once("MsCommon_mid-refactor.inc"); echo "\nTesting new connection after exception thrown in previous connection...\n"; $tableName1 = getTableName('tab1'); $conn = connect(); @@ -39,7 +30,7 @@ try { $result = selectRow($conn, $tableName1, "PDO::FETCH_ASSOC"); if ($result['c1'] == 1 && $result['c2'] == 'column2') { - echo "Test successfully completed"; + echo "Test successfully completed\n"; } //free the statement and connection dropTable($conn, $tableName); diff --git a/test/functional/pdo_sqlsrv/pdo_connection_quote.phpt b/test/functional/pdo_sqlsrv/pdo_connection_quote.phpt index 0369276d..d3865d0a 100644 --- a/test/functional/pdo_sqlsrv/pdo_connection_quote.phpt +++ b/test/functional/pdo_sqlsrv/pdo_connection_quote.phpt @@ -8,7 +8,7 @@ testing the quote method with different inputs and then test with a empty query require_once("MsCommon_mid-refactor.inc"); try { - $conn = connect("", array(), "silent"); + $conn = connect("", array(), PDO::ERRMODE_SILENT); $output1 = $conn->quote("1'2'3'4'5'6'7'8", PDO::PARAM_INT); var_dump($output1); diff --git a/test/functional/pdo_sqlsrv/pdo_errorMode.phpt b/test/functional/pdo_sqlsrv/pdo_errorMode.phpt index b7eec388..0a04e025 100644 --- a/test/functional/pdo_sqlsrv/pdo_errorMode.phpt +++ b/test/functional/pdo_sqlsrv/pdo_errorMode.phpt @@ -19,14 +19,14 @@ function testException() function testWarning() { - $db = connect("", array(), "warning"); + $db = connect("", array(), PDO::ERRMODE_WARNING); $sql = "SELECT * FROM temp_table"; $q = $db->query($sql); } function testSilent() { - $db = connect("", array(), "silent"); + $db = connect("", array(), PDO::ERRMODE_SILENT); $sql = "SELECT * FROM temp_table"; $q = $db->query($sql); } diff --git a/test/functional/pdo_sqlsrv/pdo_errorinfo_emulateprepare.phpt b/test/functional/pdo_sqlsrv/pdo_errorinfo_emulateprepare.phpt index 598fd3c4..29c4426a 100644 --- a/test/functional/pdo_sqlsrv/pdo_errorinfo_emulateprepare.phpt +++ b/test/functional/pdo_sqlsrv/pdo_errorinfo_emulateprepare.phpt @@ -9,7 +9,7 @@ require_once("MsCommon_mid-refactor.inc"); try { // connection with and without column encryption returns different warning since column encryption cannot use emulate prepare // turn ERRMODE to silent to compare the errorCode in the test - $conn = connect("", array(), "silent"); + $conn = connect("", array(), PDO::ERRMODE_SILENT); //drop, create and insert $tbname = "test_table"; diff --git a/test/functional/pdo_sqlsrv/pdo_exec_invalid_query.phpt b/test/functional/pdo_sqlsrv/pdo_exec_invalid_query.phpt index f91e6ac3..5709d931 100644 --- a/test/functional/pdo_sqlsrv/pdo_exec_invalid_query.phpt +++ b/test/functional/pdo_sqlsrv/pdo_exec_invalid_query.phpt @@ -7,7 +7,7 @@ direct execution of an invalid query require_once("MsCommon_mid-refactor.inc"); // set ERRMODE to silent to return in errorCode in the test - $conn = connect("", array(), "silent"); + $conn = connect("", array(), PDO::ERRMODE_SILENT); $tbname = "table1"; dropTable($conn, $tbname); diff --git a/test/functional/pdo_sqlsrv/pdo_get_attr_invalid.phpt b/test/functional/pdo_sqlsrv/pdo_get_attr_invalid.phpt index 5a5a718b..09be0c7d 100644 --- a/test/functional/pdo_sqlsrv/pdo_get_attr_invalid.phpt +++ b/test/functional/pdo_sqlsrv/pdo_get_attr_invalid.phpt @@ -8,7 +8,7 @@ Test getting invalid attributes require_once("MsCommon_mid-refactor.inc"); try { - $conn = connect("", array(), "silent"); + $conn = connect("", array(), PDO::ERRMODE_SILENT); @$conn->getAttribute(PDO::ATTR_FETCH_TABLE_NAMES); print_r(($conn->errorInfo())[2]); diff --git a/test/functional/pdo_sqlsrv/pdo_prepare_emulatePrepare_binary.phpt b/test/functional/pdo_sqlsrv/pdo_prepare_emulatePrepare_binary.phpt index a37b4999..f31e0893 100644 --- a/test/functional/pdo_sqlsrv/pdo_prepare_emulatePrepare_binary.phpt +++ b/test/functional/pdo_sqlsrv/pdo_prepare_emulatePrepare_binary.phpt @@ -8,7 +8,7 @@ require_once("MsCommon_mid-refactor.inc"); try { $connection_options = array(); $connection_options[PDO::ATTR_STRINGIFY_FETCHES] = true; - $cnn = connect("", $connection_options, "silent"); + $cnn = connect("", $connection_options, PDO::ERRMODE_SILENT); $pdo_options = array(); $pdo_options[PDO::ATTR_CURSOR] = PDO::CURSOR_SCROLL; diff --git a/test/functional/pdo_sqlsrv/pdo_prepare_emulatePrepare_datetime.phpt b/test/functional/pdo_sqlsrv/pdo_prepare_emulatePrepare_datetime.phpt index 368aa26a..38f4c0dc 100644 --- a/test/functional/pdo_sqlsrv/pdo_prepare_emulatePrepare_datetime.phpt +++ b/test/functional/pdo_sqlsrv/pdo_prepare_emulatePrepare_datetime.phpt @@ -7,7 +7,7 @@ prepare with emulate prepare and binding integer require_once("MsCommon_mid-refactor.inc"); try { - $conn = connect("", array(), "silent"); + $conn = connect("", array(), PDO::ERRMODE_SILENT); $tableName = "date_types"; createTable($conn, $tableName, array("c1_datetime" => "datetime", "c2_nvarchar" => "nvarchar(20)")); diff --git a/test/functional/pdo_sqlsrv/pdo_prepare_emulatePrepare_decimal.phpt b/test/functional/pdo_sqlsrv/pdo_prepare_emulatePrepare_decimal.phpt index 6af8cff6..ec40e19d 100644 --- a/test/functional/pdo_sqlsrv/pdo_prepare_emulatePrepare_decimal.phpt +++ b/test/functional/pdo_sqlsrv/pdo_prepare_emulatePrepare_decimal.phpt @@ -7,7 +7,7 @@ prepare with emulate prepare and binding integer require_once("MsCommon_mid-refactor.inc"); try { - $conn = connect("", array(), "silent"); + $conn = connect("", array(), PDO::ERRMODE_SILENT); $tableName = "number_types"; if (!isColEncrypted()) { @@ -79,7 +79,8 @@ try { var_dump($e->errorInfo); } ?> - +--XFAIL-- +Bug with column encryption: Insertion fails if input has more decimal places than the column definition --EXPECT-- Prepare without emulate prepare: Array diff --git a/test/functional/pdo_sqlsrv/pdo_warnings.phpt b/test/functional/pdo_sqlsrv/pdo_warnings.phpt index 18891d62..543b000e 100644 --- a/test/functional/pdo_sqlsrv/pdo_warnings.phpt +++ b/test/functional/pdo_sqlsrv/pdo_warnings.phpt @@ -1,29 +1,27 @@ --TEST-- Test warnings on connection and statement levels --SKIPIF-- - + --FILE-- setAttribute( PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING ); - + $conn = connect("", array(), PDO::ERRMODE_WARNING); // raise a warning in connection - $conn->getAttribute( PDO::ATTR_TIMEOUT ); - - $conn->exec("IF OBJECT_ID('table1', 'U') IS NOT NULL DROP TABLE table1"); - + $conn->getAttribute(PDO::ATTR_TIMEOUT); + + $tbname = "table1"; + dropTable($conn, $tbname); + // raise a warning in statement - $statement = $conn->prepare("CRATE TABLE table1(id INT NOT NULL PRIMARY KEY, val VARCHAR(10)) "); + $statement = $conn->prepare("CRATE TABLE table1(id INT NOT NULL PRIMARY KEY, val VARCHAR(10))"); $statement->execute(); - $statement = NULL; - $conn = NULL; -} -catch ( PDOException $e ){ - var_dump( $e->errorInfo ); + unset($statement); + unset($conn); +} catch (PDOException $e) { + var_dump($e->errorInfo); exit; } ?> @@ -35,4 +33,4 @@ Error Message: An unsupported attribute was designated on the PDO object\. Warning: PDO::getAttribute\(\): SQLSTATE\[IM001\]: Driver does not support this function: driver does not support that attribute in .+(\/|\\)pdo_warnings\.php on line [0-9]+ -Warning: PDOStatement::execute\(\): SQLSTATE\[42000\]: Syntax error or access violation: 156 \[Microsoft\]\[ODBC Driver 1[1-9] for SQL Server\]\[SQL Server\]Incorrect syntax near the keyword 'TABLE'\. in .+(\/|\\)pdo_warnings\.php on line [0-9]+ \ No newline at end of file +Warning: PDOStatement::execute\(\): SQLSTATE\[42000\]: Syntax error or access violation: 156 \[Microsoft\]\[ODBC Driver [0-9]+ for SQL Server\]\[SQL Server\]Incorrect syntax near the keyword 'TABLE'\. in .+(\/|\\)pdo_warnings\.php on line [0-9]+