Annotation of embedaddon/php/ext/pdo_mysql/tests/bug_pecl_7976.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: PECL Bug #7976 (Calling stored procedure several times)
3: --SKIPIF--
4: <?php
5: if (!extension_loaded('pdo') || !extension_loaded('pdo_mysql')) die('skip not loaded');
6: require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'skipif.inc');
7: require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
8: MySQLPDOTest::skip();
9: $db = MySQLPDOTest::factory();
10:
11: $row = $db->query('SELECT VERSION() as _version')->fetch(PDO::FETCH_ASSOC);
12: $matches = array();
13: if (!preg_match('/^(\d+)\.(\d+)\.(\d+)/ismU', $row['_version'], $matches))
14: die(sprintf("skip Cannot determine MySQL Server version\n"));
15:
16: $version = $matches[0] * 10000 + $matches[1] * 100 + $matches[2];
17: if ($version < 50000)
18: die(sprintf("skip Need MySQL Server 5.0.0+, found %d.%02d.%02d (%d)\n",
19: $matches[0], $matches[1], $matches[2], $version));
20: ?>
21: --FILE--
22: <?php
23: require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
24: $db = MySQLPDOTest::factory();
25:
26: function bug_pecl_7976($db) {
27:
28: $db->exec('DROP PROCEDURE IF EXISTS p');
29: $db->exec('CREATE PROCEDURE p() BEGIN SELECT "1" AS _one; END;');
30:
31: $stmt = $db->query('CALL p()');
32: var_dump($stmt->fetchAll(PDO::FETCH_ASSOC));
33: $stmt->closeCursor();
34:
35: $stmt = $db->query('CALL p()');
36: var_dump($stmt->fetchAll(PDO::FETCH_ASSOC));
37: $stmt->closeCursor();
38:
39: }
40:
41: printf("Emulated...\n");
42: $db = MySQLPDOTest::factory();
43: $db->setAttribute(PDO::ATTR_EMULATE_PREPARES, 1);
44: bug_pecl_7976($db);
45:
46: printf("Native...\n");
47: $db = MySQLPDOTest::factory();
48: $db->setAttribute(PDO::ATTR_EMULATE_PREPARES, 0);
49: bug_pecl_7976($db);
50:
51: print "done!";
52: ?>
53: --CLEAN--
54: <?php
55: require dirname(__FILE__) . '/mysql_pdo_test.inc';
56: $db = MySQLPDOTest::factory();
57: $db->exec('DROP PROCEDURE IF EXISTS p');
58: ?>
59: --XFAIL--
60: Works with mysqlnd. It is not supported by libmysql. For libmysql is good enough to see no crash.
61: --EXPECTF--
62: Emulated...
63: array(1) {
64: [0]=>
65: array(1) {
66: [%u|b%"_one"]=>
67: %unicode|string%(1) "1"
68: }
69: }
70: array(1) {
71: [0]=>
72: array(1) {
73: [%u|b%"_one"]=>
74: %unicode|string%(1) "1"
75: }
76: }
77: Native...
78: array(1) {
79: [0]=>
80: array(1) {
81: [%u|b%"_one"]=>
82: %unicode|string%(1) "1"
83: }
84: }
85: array(1) {
86: [0]=>
87: array(1) {
88: [%u|b%"_one"]=>
89: %unicode|string%(1) "1"
90: }
91: }
92: done!
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>