|
2 | 2 | PDO MySQL Bug #61207 (PDO::nextRowset() after a multi-statement query doesn't always work)
|
3 | 3 | --SKIPIF--
|
4 | 4 | <?php
|
5 |
| -if (!extension_loaded('pdo') || !extension_loaded('pdo_mysql')) die('skip not loaded'); |
6 |
| -require dirname(__FILE__) . '/config.inc'; |
7 |
| -require dirname(__FILE__) . '/../../../ext/pdo/tests/pdo_test.inc'; |
8 |
| -PDOTest::skip(); |
| 5 | +require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'skipif.inc'); |
| 6 | +require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc'); |
| 7 | +MySQLPDOTest::skip(); |
| 8 | + |
9 | 9 | ?>
|
10 | 10 | --FILE--
|
11 | 11 | <?php
|
12 |
| -require dirname(__FILE__) . '/../../../ext/pdo/tests/pdo_test.inc'; |
| 12 | +require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc'); |
| 13 | +$db = MySQLPDOTest::factory(); |
13 | 14 |
|
14 |
| -$link = PDOTest::test_factory(dirname(__FILE__) . '/common.phpt'); |
| 15 | +$db->query('DROP TABLE IF EXISTS test'); |
| 16 | +$db->query('create table `test`( `id` int )'); |
15 | 17 |
|
16 |
| -$link->query('create table `bug61207`( `id` int )'); |
| 18 | +$handle1 = $db->prepare('insert into test(id) values(1); |
| 19 | + select * from test where id = ?; |
| 20 | + update test set id = 2 where id = ?;'); |
17 | 21 |
|
18 |
| -$handle1 = $link->prepare('insert into bug61207(id) values(1); |
19 |
| - select * from bug61207 where id = ?; |
20 |
| - update bug61207 set id = 2 where id = ?;'); |
21 |
| - |
22 | 22 | $handle1->bindValue('1', '1');
|
23 | 23 | $handle1->bindValue('2', '1');
|
24 |
| - |
25 |
| -$handle1->execute(); |
| 24 | + |
| 25 | +$handle1->execute(); |
26 | 26 | $i = 1;
|
27 | 27 | print("Handle 1:\n");
|
28 | 28 | do {
|
|
31 | 31 | print("Results detected\n");
|
32 | 32 | } while($handle1->nextRowset());
|
33 | 33 |
|
34 |
| -$handle2 = $link->prepare('select * from bug61207 where id = ?; |
35 |
| - update bug61207 set id = 1 where id = ?;'); |
36 |
| - |
| 34 | +$handle2 = $db->prepare('select * from test where id = ?; |
| 35 | + update test set id = 1 where id = ?;'); |
| 36 | + |
37 | 37 | $handle2->bindValue('1', '2');
|
38 | 38 | $handle2->bindValue('2', '2');
|
39 | 39 |
|
|
47 | 47 | print("Results detected\n");
|
48 | 48 | } while($handle2->nextRowset());
|
49 | 49 |
|
50 |
| -$handle3 = $link->prepare('update bug61207 set id = 2 where id = ?; |
51 |
| - select * from bug61207 where id = ?;'); |
52 |
| - |
| 50 | +$handle3 = $db->prepare('update test set id = 2 where id = ?; |
| 51 | + select * from test where id = ?;'); |
| 52 | + |
53 | 53 | $handle3->bindValue('1', '1');
|
54 | 54 | $handle3->bindValue('2', '2');
|
55 | 55 |
|
|
63 | 63 | print("Results detected\n");
|
64 | 64 | } while($handle3->nextRowset());
|
65 | 65 |
|
66 |
| -$handle4 = $link->prepare('insert into bug61207(id) values(3); |
67 |
| - update bug61207 set id = 2 where id = ?; |
68 |
| - select * from bug61207 where id = ?;'); |
69 |
| - |
| 66 | +$handle4 = $db->prepare('insert into test(id) values(3); |
| 67 | + update test set id = 2 where id = ?; |
| 68 | + select * from test where id = ?;'); |
| 69 | + |
70 | 70 | $handle4->bindValue('1', '3');
|
71 | 71 | $handle4->bindValue('2', '2');
|
72 |
| - |
| 72 | + |
73 | 73 | $handle4->execute();
|
74 |
| - |
| 74 | + |
75 | 75 | $i = 1;
|
76 | 76 | print("Handle 4:\n");
|
77 | 77 | do {
|
|
80 | 80 | print("Results detected\n");
|
81 | 81 | } while($handle1->nextRowset());
|
82 | 82 |
|
83 |
| -$link->query("DROP TABLE bug61207"); |
| 83 | +$db->query("DROP TABLE test"); |
| 84 | +?> |
| 85 | +--CLEAN-- |
| 86 | +<?php |
| 87 | +require dirname(__FILE__) . '/mysql_pdo_test.inc'; |
| 88 | +MySQLPDOTest::dropTestTable(); |
84 | 89 | ?>
|
85 | 90 | --EXPECT--
|
86 | 91 | Handle 1:
|
|
0 commit comments