Annotation of embedaddon/php/ext/pdo_mysql/tests/bug_61207.phpt, revision 1.1.1.2

1.1       misho       1: --TEST--
                      2: PDO MySQL Bug #61207 (PDO::nextRowset() after a multi-statement query doesn't always work)
                      3: --SKIPIF--
                      4: <?php
1.1.1.2 ! misho       5: require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'skipif.inc');
        !             6: require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
        !             7: MySQLPDOTest::skip();
        !             8: 
1.1       misho       9: ?>
                     10: --FILE--
                     11: <?php
1.1.1.2 ! misho      12: require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
        !            13: $db = MySQLPDOTest::factory();
1.1       misho      14: 
1.1.1.2 ! misho      15: $db->query('DROP TABLE IF EXISTS test');
        !            16: $db->query('create table `test`( `id` int )');
1.1       misho      17: 
1.1.1.2 ! misho      18: $handle1 = $db->prepare('insert into test(id) values(1);
        !            19:                           select * from test where id = ?;
        !            20:                           update test set id = 2 where id = ?;');
1.1       misho      21: 
                     22: $handle1->bindValue('1', '1');
                     23: $handle1->bindValue('2', '1');
1.1.1.2 ! misho      24: 
        !            25: $handle1->execute();
1.1       misho      26: $i = 1;
                     27: print("Handle 1:\n");
                     28: do {
                     29:        print('Rowset ' . $i++ . "\n");
                     30:        if ($handle1->columnCount() > 0)
                     31:                print("Results detected\n");
                     32: } while($handle1->nextRowset());
                     33: 
1.1.1.2 ! misho      34: $handle2 = $db->prepare('select * from test where id = ?;
        !            35:                            update test set id = 1 where id = ?;');
        !            36: 
1.1       misho      37: $handle2->bindValue('1', '2');
                     38: $handle2->bindValue('2', '2');
                     39: 
                     40: $handle2->execute();
                     41: 
                     42: $i = 1;
                     43: print("Handle 2:\n");
                     44: do {
                     45:        print('Rowset ' . $i++ . "\n");
                     46:        if ($handle2->columnCount() > 0)
                     47:                print("Results detected\n");
                     48: } while($handle2->nextRowset());
                     49: 
1.1.1.2 ! misho      50: $handle3 = $db->prepare('update test set id = 2 where id = ?;
        !            51:                            select * from test where id = ?;');
        !            52: 
1.1       misho      53: $handle3->bindValue('1', '1');
                     54: $handle3->bindValue('2', '2');
                     55: 
                     56: $handle3->execute();
                     57: 
                     58: $i = 1;
                     59: print("Handle 3:\n");
                     60: do {
                     61:        print('Rowset ' . $i++ . "\n");
                     62:        if ($handle3->columnCount() > 0)
                     63:                print("Results detected\n");
                     64: } while($handle3->nextRowset());
                     65: 
1.1.1.2 ! misho      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: 
1.1       misho      70: $handle4->bindValue('1', '3');
                     71: $handle4->bindValue('2', '2');
1.1.1.2 ! misho      72: 
1.1       misho      73: $handle4->execute();
1.1.1.2 ! misho      74: 
1.1       misho      75: $i = 1;
                     76: print("Handle 4:\n");
                     77: do {
                     78:        print('Rowset ' . $i++ . "\n");
                     79:        if ($handle1->columnCount() > 0)
                     80:                print("Results detected\n");
                     81: } while($handle1->nextRowset());
                     82: 
1.1.1.2 ! misho      83: $db->query("DROP TABLE test");
        !            84: ?>
        !            85: --CLEAN--
        !            86: <?php
        !            87: require dirname(__FILE__) . '/mysql_pdo_test.inc';
        !            88: MySQLPDOTest::dropTestTable();
1.1       misho      89: ?>
                     90: --EXPECT--
                     91: Handle 1:
                     92: Rowset 1
                     93: Rowset 2
                     94: Results detected
                     95: Rowset 3
                     96: Handle 2:
                     97: Rowset 1
                     98: Results detected
                     99: Rowset 2
                    100: Handle 3:
                    101: Rowset 1
                    102: Rowset 2
                    103: Results detected
                    104: Handle 4:
                    105: Rowset 1
                    106: Rowset 2
                    107: Rowset 3
                    108: Results detected

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>