Annotation of embedaddon/php/ext/pdo_mysql/tests/bug_61207.phpt, revision 1.1
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
! 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();
! 9: ?>
! 10: --FILE--
! 11: <?php
! 12: require dirname(__FILE__) . '/../../../ext/pdo/tests/pdo_test.inc';
! 13:
! 14: $link = PDOTest::test_factory(dirname(__FILE__) . '/common.phpt');
! 15:
! 16: $link->query('create table `bug61207`( `id` int )');
! 17:
! 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: $handle1->bindValue('1', '1');
! 23: $handle1->bindValue('2', '1');
! 24:
! 25: $handle1->execute();
! 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:
! 34: $handle2 = $link->prepare('select * from bug61207 where id = ?;
! 35: update bug61207 set id = 1 where id = ?;');
! 36:
! 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:
! 50: $handle3 = $link->prepare('update bug61207 set id = 2 where id = ?;
! 51: select * from bug61207 where id = ?;');
! 52:
! 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:
! 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:
! 70: $handle4->bindValue('1', '3');
! 71: $handle4->bindValue('2', '2');
! 72:
! 73: $handle4->execute();
! 74:
! 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:
! 83: $link->query("DROP TABLE bug61207");
! 84: ?>
! 85: --EXPECT--
! 86: Handle 1:
! 87: Rowset 1
! 88: Rowset 2
! 89: Results detected
! 90: Rowset 3
! 91: Handle 2:
! 92: Rowset 1
! 93: Results detected
! 94: Rowset 2
! 95: Handle 3:
! 96: Rowset 1
! 97: Rowset 2
! 98: Results detected
! 99: Handle 4:
! 100: Rowset 1
! 101: Rowset 2
! 102: Rowset 3
! 103: Results detected
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>