-
Notifications
You must be signed in to change notification settings - Fork 7.8k
/
Copy pathbug63185.phpt
74 lines (69 loc) · 1.69 KB
/
bug63185.phpt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
--TEST--
Bug #63185: nextRowset() ignores MySQL errors with native prepared statements
--EXTENSIONS--
pdo
pdo_mysql
--SKIPIF--
<?php
require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
MySQLPDOTest::skip();
?>
--FILE--
<?php
require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
$pdo = MySQLPDOTest::factory();
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$pdo->exec('DROP PROCEDURE IF EXISTS test_procedure_error_at_second');
$pdo->exec('CREATE PROCEDURE test_procedure_error_at_second ()
BEGIN
SELECT "x" as foo;
SELECT * FROM no_such_table;
END');
$pdo->setAttribute(PDO::ATTR_EMULATE_PREPARES, true);
$st = $pdo->query('CALL test_procedure_error_at_second()');
var_dump($st->fetchAll());
try {
var_dump($st->nextRowset());
} catch (PDOException $e) {
echo $e->getMessage(), "\n";
}
unset($st);
$pdo->setAttribute(PDO::ATTR_EMULATE_PREPARES, false);
$st = $pdo->query('CALL test_procedure_error_at_second()');
var_dump($st->fetchAll());
try {
var_dump($st->nextRowset());
} catch (PDOException $e) {
echo $e->getMessage(), "\n";
}
var_dump($st->fetchAll());
?>
--CLEAN--
<?php
require_once __DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc';
$pdo = MySQLPDOTest::factory();
$pdo->query('DROP PROCEDURE IF EXISTS test_procedure_error_at_second');
?>
--EXPECTF--
array(1) {
[0]=>
array(2) {
["foo"]=>
string(1) "x"
[0]=>
string(1) "x"
}
}
SQLSTATE[42S02]: Base table or view not found: 1146 Table '%s.no_such_table' doesn't exist
array(1) {
[0]=>
array(2) {
["foo"]=>
string(1) "x"
[0]=>
string(1) "x"
}
}
SQLSTATE[42S02]: Base table or view not found: 1146 Table '%s.no_such_table' doesn't exist
array(0) {
}