Browse Source

- 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)
PECL
David Coallier 17 years ago
parent
commit
55ad0efd17
  1. 38
      ext/pdo_mysql/tests/bug41125.phpt
  2. 14
      ext/pdo_mysql/tests/bug_41997.phpt
  3. 4
      ext/pdo_mysql/tests/pdo_mysql_begintransaction.phpt
  4. 74
      ext/pdo_mysql/tests/pdo_mysql_errorinfo.phpt
  5. 4
      ext/pdo_mysql/tests/pdo_mysql_prepare_emulated_anonymous.phpt
  6. 6
      ext/pdo_mysql/tests/pdo_mysql_prepare_emulated_placeholder_everywhere.phpt
  7. 6
      ext/pdo_mysql/tests/pdo_mysql_prepare_native_dup_named_placeholder.phpt
  8. 4
      ext/pdo_mysql/tests/pdo_mysql_prepare_native_named_placeholder.phpt
  9. 20
      ext/pdo_mysql/tests/pdo_mysql_stmt_errorinfo.phpt
  10. 14
      ext/pdo_mysql/tests/pdo_mysql_stmt_multiquery.phpt
  11. 5
      ext/pdo_mysql/tests/pecl_bug_5780.phpt

38
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 - -
--------

14
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!
done!

4
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!
done!

74
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!
done!

4
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!
done!

6
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!
done!

6
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!
done!

4
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!
done!

20
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!
done!

14
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
Fatal error: Call to a member function errorInfo() on a non-object in %s on line %d

5
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
}
Loading…
Cancel
Save