diff options
author | David Coallier <davidc@php.net> | 2008-11-10 18:44:04 +0000 |
---|---|---|
committer | David Coallier <davidc@php.net> | 2008-11-10 18:44:04 +0000 |
commit | 55ad0efd17e11162d0995e7472f46fe78bd2bb9a (patch) | |
tree | 66e453adfd55ef11d5f2b6e73cd1211748cf4e85 | |
parent | 1460f722e3baab33540135790d186f4bbe5f574f (diff) | |
download | php-git-55ad0efd17e11162d0995e7472f46fe78bd2bb9a.tar.gz |
- Make test conform to the error reporting that always returns
three elements. Adjusted all bugs and tests that were using
errorInfo() and errorCode() (dbh & stmt)
11 files changed, 84 insertions, 105 deletions
diff --git a/ext/pdo_mysql/tests/bug41125.phpt b/ext/pdo_mysql/tests/bug41125.phpt index 5889a4d291..cd913bbf3a 100644 --- a/ext/pdo_mysql/tests/bug41125.phpt +++ b/ext/pdo_mysql/tests/bug41125.phpt @@ -85,78 +85,78 @@ foreach ($queries as $k => $query) { ?> --EXPECT-- 1 -00000 +00000 - - ------------------------------------------------------- [1] Query: [[SELECT 1 FROM DUAL WHERE 1 = '?\'\'']] -00000 +00000 - - -------- [2] Query: [[SELECT 'a\'0' FROM DUAL WHERE 1 = ?]] a'0 -00000 +00000 - - -------- [3] Query: [[SELECT 'a', 'b\'' FROM DUAL WHERE '''' LIKE '\'' AND ?]] a - b' -00000 +00000 - - -------- [4] Query: [[SELECT 'foo?bar', '', '''' FROM DUAL WHERE ?]] foo?bar - - ' -00000 +00000 - - -------- Query: [[SELECT upper(:id) FROM DUAL WHERE '1']] O'\0 -00000 +00000 - - ------------------------------------------------------- [1] Query: [[SELECT 1, 'foo' FROM DUAL WHERE 1 = :id AND '\0' IS NULL AND 2 <> :id]] -00000 +00000 - - -------- [2] Query: [[SELECT 1 FROM DUAL WHERE 1 = :id AND '' AND 2 <> :id]] -00000 +00000 - - -------- [3] Query: [[SELECT 1 FROM DUAL WHERE 1 = :id AND '\'\'' = '''' AND 2 <> :id]] -00000 +00000 - - -------- [4] Query: [[SELECT 1 FROM DUAL WHERE 1 = :id AND '\'' = '''' AND 2 <> :id]] 1 -00000 +00000 - - -------- [5] Query: [[SELECT 'a', 'b\'' FROM DUAL WHERE '''' LIKE '\'' AND 1]] a - b' -00000 +00000 - - -------- [6] Query: [[SELECT 'a''', '\'b\'' FROM DUAL WHERE '''' LIKE '\'' AND 1]] a' - 'b' -00000 +00000 - - -------- [7] Query: [[SELECT UPPER(:id) FROM DUAL WHERE '1']] 1 -00000 +00000 - - -------- [8] Query: [[SELECT 1 FROM DUAL WHERE '\'']] -00000 +00000 - - -------- [9] Query: [[SELECT 1 FROM DUAL WHERE :id AND '\0' OR :id]] 1 -00000 +00000 - - -------- [10] Query: [[SELECT 1 FROM DUAL WHERE 'a\f\n\0' AND 1 >= :id]] -00000 +00000 - - -------- [11] Query: [[SELECT 1 FROM DUAL WHERE '\'' = '''']] 1 -00000 +00000 - - -------- [12] Query: [[SELECT '\n' '1 FROM DUAL WHERE '''' and :id']] 1 FROM DUAL WHERE '' and :id -00000 +00000 - - -------- [13] Query: [[SELECT 1 'FROM DUAL WHERE :id AND '''' = '''' OR 1 = 1 AND ':id]] 1 -00000 +00000 - - -------- diff --git a/ext/pdo_mysql/tests/bug_41997.phpt b/ext/pdo_mysql/tests/bug_41997.phpt index 60bdfee2ba..c48a641f97 100644 --- a/ext/pdo_mysql/tests/bug_41997.phpt +++ b/ext/pdo_mysql/tests/bug_41997.phpt @@ -46,9 +46,13 @@ array(1) { string(1) "1" } } -array(1) { +array(3) { [0]=> string(5) "00000" + [1]=> + NULL + [2]=> + NULL } array(1) { [0]=> @@ -57,8 +61,12 @@ array(1) { string(1) "2" } } -array(1) { +array(3) { [0]=> string(5) "00000" + [1]=> + NULL + [2]=> + NULL } -done!
\ No newline at end of file +done! diff --git a/ext/pdo_mysql/tests/pdo_mysql_begintransaction.phpt b/ext/pdo_mysql/tests/pdo_mysql_begintransaction.phpt index 209bf3d89d..30aecf4b54 100644 --- a/ext/pdo_mysql/tests/pdo_mysql_begintransaction.phpt +++ b/ext/pdo_mysql/tests/pdo_mysql_begintransaction.phpt @@ -195,7 +195,7 @@ array(2) { ["label"]=> string(1) "z" } -[026] Autocommit mode of the MySQL Server should be off, got '1', [0] 00000 +[026] Autocommit mode of the MySQL Server should be off, got '1', [0] 00000 [028] I'm confused, how can autocommit be on? Didn't I say I want to manually control transactions? string(5) "00000" -done!
\ No newline at end of file +done! diff --git a/ext/pdo_mysql/tests/pdo_mysql_errorinfo.phpt b/ext/pdo_mysql/tests/pdo_mysql_errorinfo.phpt index 8829dc448a..99b2b846b5 100644 --- a/ext/pdo_mysql/tests/pdo_mysql_errorinfo.phpt +++ b/ext/pdo_mysql/tests/pdo_mysql_errorinfo.phpt @@ -14,13 +14,9 @@ $db = MySQLPDOTest::factory(); MySQLPDOTest::createTestTable($db); function check_error($offset, &$obj, $expected = '00000') { - $info = $obj->errorInfo(); - if (count($info) != 3) - printf("[%03d] Info should have three fields, got %s\n", - $offset, var_export($info, true)); - $code = $info[0]; + if (($code != $expected) && (($expected != '00000') && ($code != ''))) { printf("[%03d] Expecting error code '%s' got code '%s'\n", $offset, $expected, $code); @@ -33,6 +29,8 @@ $db = MySQLPDOTest::factory(); printf("[%03d] Driver-specific error message.not set\n", $offset); } + + } function pdo_mysql_errorinfo($db, $offset) { @@ -100,74 +98,12 @@ $db = MySQLPDOTest::factory(); $db->exec('DROP TABLE IF EXISTS test'); print "done!"; +?> --EXPECTF-- Emulated Prepared Statements... -[002] Info should have three fields, got array ( - 0 => '00000', -) -[003] Info should have three fields, got array ( - 0 => '00000', -) -[004] Info should have three fields, got array ( - 0 => '00000', -) -[005] Info should have three fields, got array ( - 0 => '00000', -) -[009] Info should have three fields, got array ( - 0 => '00000', -) -[010] Info should have three fields, got array ( - 0 => '00000', -) -[013] Info should have three fields, got array ( - 0 => '00000', -) -[014] Info should have three fields, got array ( - 0 => '00000', -) -[015] Info should have three fields, got array ( - 0 => 'IM001', -) [015] Driver-specific error code not set [015] Driver-specific error message.not set -[016] Info should have three fields, got array ( - 0 => 'IM001', -) [016] Driver-specific error code not set [016] Driver-specific error message.not set -[017] Info should have three fields, got array ( - 0 => '00000', -) -[018] Info should have three fields, got array ( - 0 => '00000', -) Native Prepared Statements... -[022] Info should have three fields, got array ( - 0 => '00000', -) -[023] Info should have three fields, got array ( - 0 => '00000', -) -[024] Info should have three fields, got array ( - 0 => '00000', -) -[025] Info should have three fields, got array ( - 0 => '00000', -) -[030] Info should have three fields, got array ( - 0 => '00000', -) -[033] Info should have three fields, got array ( - 0 => '00000', -) -[034] Info should have three fields, got array ( - 0 => '00000', -) -[037] Info should have three fields, got array ( - 0 => '00000', -) -[038] Info should have three fields, got array ( - 0 => '00000', -) -done!
\ No newline at end of file +done! diff --git a/ext/pdo_mysql/tests/pdo_mysql_prepare_emulated_anonymous.phpt b/ext/pdo_mysql/tests/pdo_mysql_prepare_emulated_anonymous.phpt index 1f333b9a99..30edcbe4b4 100644 --- a/ext/pdo_mysql/tests/pdo_mysql_prepare_emulated_anonymous.phpt +++ b/ext/pdo_mysql/tests/pdo_mysql_prepare_emulated_anonymous.phpt @@ -72,7 +72,9 @@ array(1) { now the same with native PS [005] Execute has failed, 'HY093' array ( 0 => 'HY093', + 1 => NULL, + 2 => NULL, ) array(0) { } -done!
\ No newline at end of file +done! diff --git a/ext/pdo_mysql/tests/pdo_mysql_prepare_emulated_placeholder_everywhere.phpt b/ext/pdo_mysql/tests/pdo_mysql_prepare_emulated_placeholder_everywhere.phpt index be83446c85..a8faa8d13b 100644 --- a/ext/pdo_mysql/tests/pdo_mysql_prepare_emulated_placeholder_everywhere.phpt +++ b/ext/pdo_mysql/tests/pdo_mysql_prepare_emulated_placeholder_everywhere.phpt @@ -59,6 +59,8 @@ MySQLPDOTest::skip(); Warning: PDOStatement::execute(): SQLSTATE[HY093]: Invalid parameter number in %s on line %d [003] Execute has failed, 'HY093' array ( 0 => 'HY093', + 1 => NULL, + 2 => NULL, ) array(0) { } @@ -69,7 +71,9 @@ Warning: PDOStatement::execute(): SQLSTATE[HY093]: Invalid parameter number: num Warning: PDOStatement::execute(): SQLSTATE[HY093]: Invalid parameter number in %s on line 33 [005] Execute has failed, 'HY093' array ( 0 => 'HY093', + 1 => NULL, + 2 => NULL, ) array(0) { } -done!
\ No newline at end of file +done! diff --git a/ext/pdo_mysql/tests/pdo_mysql_prepare_native_dup_named_placeholder.phpt b/ext/pdo_mysql/tests/pdo_mysql_prepare_native_dup_named_placeholder.phpt index a84c8d56d2..4f901964ec 100644 --- a/ext/pdo_mysql/tests/pdo_mysql_prepare_native_dup_named_placeholder.phpt +++ b/ext/pdo_mysql/tests/pdo_mysql_prepare_native_dup_named_placeholder.phpt @@ -101,6 +101,8 @@ Native... Warning: PDOStatement::execute(): SQLSTATE[HY093]: Invalid parameter number in %s on line %d [003] Execute has failed, 'HY093' array ( 0 => 'HY093', + 1 => NULL, + 2 => NULL, ) array(0) { } @@ -130,7 +132,9 @@ Native... Warning: PDOStatement::execute(): SQLSTATE[HY093]: Invalid parameter number in %s on line %d [008] Execute has failed, 'HY093' array ( 0 => 'HY093', + 1 => NULL, + 2 => NULL, ) array(0) { } -done!
\ No newline at end of file +done! diff --git a/ext/pdo_mysql/tests/pdo_mysql_prepare_native_named_placeholder.phpt b/ext/pdo_mysql/tests/pdo_mysql_prepare_native_named_placeholder.phpt index 6f673c78b2..4ead73d7fd 100644 --- a/ext/pdo_mysql/tests/pdo_mysql_prepare_native_named_placeholder.phpt +++ b/ext/pdo_mysql/tests/pdo_mysql_prepare_native_named_placeholder.phpt @@ -70,6 +70,8 @@ $db = MySQLPDOTest::factory(); --EXPECTF-- [003] Execute has failed, 'HY093' array ( 0 => 'HY093', + 1 => NULL, + 2 => NULL, ) array(0) { } @@ -82,4 +84,4 @@ array(1) { string(12) ":placeholder" } } -done!
\ No newline at end of file +done! diff --git a/ext/pdo_mysql/tests/pdo_mysql_stmt_errorinfo.phpt b/ext/pdo_mysql/tests/pdo_mysql_stmt_errorinfo.phpt index c29ffff157..da372534fd 100644 --- a/ext/pdo_mysql/tests/pdo_mysql_stmt_errorinfo.phpt +++ b/ext/pdo_mysql/tests/pdo_mysql_stmt_errorinfo.phpt @@ -61,9 +61,13 @@ $db = MySQLPDOTest::factory(); ?> --EXPECTF-- Testing emulated PS... -array(1) { +array(3) { [0]=> string(0) "" + [1]=> + NULL + [2]=> + NULL } Warning: PDOStatement::execute(): SQLSTATE[42S02]: Base table or view not found: 1146 Table '%s.ihopeitdoesnotexist' doesn't exist in %s on line %d @@ -86,17 +90,25 @@ array(3) { [2]=> string(%d) "Table '%s.test' doesn't exist" } -array(1) { +array(3) { [0]=> string(5) "00000" + [1]=> + NULL + [2]=> + NULL } Testing native PS... Warning: PDO::prepare(): SQLSTATE[42S02]: Base table or view not found: 1146 Table '%s.ihopeitdoesnotexist' doesn't exist in %s on line %d bool(false) -array(1) { +array(3) { [0]=> string(0) "" + [1]=> + NULL + [2]=> + NULL } Warning: PDOStatement::execute(): SQLSTATE[42S02]: Base table or view not found: 1146 Table '%s.test' doesn't exist in %s on line %d @@ -116,4 +128,4 @@ array(3) { [2]=> string(%d) "Table '%s.ihopeitdoesnotexist' doesn't exist" } -done!
\ No newline at end of file +done! diff --git a/ext/pdo_mysql/tests/pdo_mysql_stmt_multiquery.phpt b/ext/pdo_mysql/tests/pdo_mysql_stmt_multiquery.phpt index dbf60d527a..f88a1a385e 100644 --- a/ext/pdo_mysql/tests/pdo_mysql_stmt_multiquery.phpt +++ b/ext/pdo_mysql/tests/pdo_mysql_stmt_multiquery.phpt @@ -54,9 +54,13 @@ MySQLPDOTest::skip(); ?> --EXPECTF-- Emulated Prepared Statements... -array(1) { +array(3) { [0]=> string(5) "00000" + [1]=> + NULL + [2]=> + NULL } array(1) { [0]=> @@ -65,9 +69,13 @@ array(1) { string(1) "a" } } -array(1) { +array(3) { [0]=> string(5) "00000" + [1]=> + NULL + [2]=> + NULL } array(1) { [0]=> @@ -87,4 +95,4 @@ Native Prepared Statements... Warning: PDO::query(): SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '; SELECT label FROM test ORDER BY id ASC LIMIT 1' at line %d in %s on line %d -Fatal error: Call to a member function errorInfo() on a non-object in %s on line %d
\ No newline at end of file +Fatal error: Call to a member function errorInfo() on a non-object in %s on line %d diff --git a/ext/pdo_mysql/tests/pecl_bug_5780.phpt b/ext/pdo_mysql/tests/pecl_bug_5780.phpt index c2e0a79371..5cc3497895 100644 --- a/ext/pdo_mysql/tests/pecl_bug_5780.phpt +++ b/ext/pdo_mysql/tests/pecl_bug_5780.phpt @@ -25,6 +25,7 @@ var_dump($authstmt->fetch(PDO::FETCH_NUM)); $info = $logstmt->errorInfo(); unset($info[2]); var_dump($info); +?> --EXPECT-- array(2) { [0]=> @@ -33,7 +34,9 @@ array(2) { string(7) "testing" } bool(true) -array(1) { +array(2) { [0]=> string(5) "00000" + [1]=> + NULL } |