xref: /php-src/ext/pdo_mysql/tests/bug_41997.phpt (revision 4bb75d56)
1--TEST--
2PDO MySQL Bug #41997 (stored procedure call returning single rowset blocks future queries)
3--EXTENSIONS--
4pdo_mysql
5--SKIPIF--
6<?php
7require_once __DIR__ . '/inc/mysql_pdo_test.inc';
8MySQLPDOTest::skip();
9?>
10--FILE--
11<?php
12require_once __DIR__ . '/inc/mysql_pdo_test.inc';
13$db = MySQLPDOTest::factory();
14$db->setAttribute(PDO::ATTR_STRINGIFY_FETCHES, true);
15
16$procedure = 'bug_41997_pdo_mysql_p';
17
18$db->exec("CREATE PROCEDURE {$procedure}() BEGIN SELECT 1 AS 'one'; END");
19
20$stmt = $db->query("CALL {$procedure}()");
21do {
22    var_dump($stmt->fetchAll(PDO::FETCH_ASSOC));
23} while ($stmt->nextRowset());
24var_dump($stmt->errorInfo());
25
26$stmt = $db->query('SELECT 2 AS "two"');
27var_dump($stmt->fetchAll(PDO::FETCH_ASSOC));
28var_dump($stmt->errorInfo());
29print "done!";
30?>
31--CLEAN--
32<?php
33require_once __DIR__ . '/inc/mysql_pdo_test.inc';
34$db = MySQLPDOTest::factory();
35$db->exec("DROP PROCEDURE IF EXISTS bug_41997_pdo_mysql_p");
36?>
37--EXPECT--
38array(1) {
39  [0]=>
40  array(1) {
41    ["one"]=>
42    string(1) "1"
43  }
44}
45array(0) {
46}
47array(3) {
48  [0]=>
49  string(5) "00000"
50  [1]=>
51  NULL
52  [2]=>
53  NULL
54}
55array(1) {
56  [0]=>
57  array(1) {
58    ["two"]=>
59    string(1) "2"
60  }
61}
62array(3) {
63  [0]=>
64  string(5) "00000"
65  [1]=>
66  NULL
67  [2]=>
68  NULL
69}
70done!
71