Annotation of embedaddon/php/ext/mysql/tests/mysql_pconn_disable.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: mysql_pconnect() - disabling feature
3: --SKIPIF--
4: <?php
5: require_once('skipif.inc');
6: require_once('skipifconnectfailure.inc');
7: ?>
8: --INI--
9: mysql.allow_persistent=0
10: mysql.max_persistent=1
11: mysql.max_links=2
12: --FILE--
13: <?php
14: require_once("connect.inc");
15: require_once("table.inc");
16:
17: if (($plink = my_mysql_connect($host, $user, $passwd, $db, $port, $socket, NULL, true)))
18: printf("[001] Can connect to the server.\n");
19:
20: if (($res = mysql_query('SELECT id FROM test ORDER BY id ASC', $plink)) &&
21: ($row = mysql_fetch_assoc($res)) &&
22: (mysql_free_result($res))) {
23: printf("[002] Can fetch data using persistent connection! Data = '%s'\n",
24: $row['id']);
25: }
26:
27: $thread_id = mysql_thread_id($plink);
28: mysql_close($plink);
29:
30: if (!($plink = my_mysql_connect($host, $user, $passwd, $db, $port, $socket, NULL, true)))
31: printf("[003] Cannot connect, [%d] %s\n", mysql_errno(), mysql_error());
32:
33: if (mysql_thread_id($plink) != $thread_id)
34: printf("[004] Looks like the second call to pconnect() did not give us the same connection.\n");
35:
36: $thread_id = mysql_thread_id($plink);
37: mysql_close($plink);
38:
39: if (!($plink = my_mysql_connect($host, $user, $passwd, $db, $port, $socket)))
40: printf("[005] Cannot connect, [%d] %s\n", mysql_errno(), mysql_error());
41:
42: if (mysql_thread_id($plink) == $thread_id)
43: printf("[006] Looks like connect() did not return a new connection.\n");
44:
45: print "done!";
46: ?>
47: --CLEAN--
48: <?php
49: require_once("clean_table.inc");
50: ?>
51: --EXPECTF--
52: [001] Can connect to the server.
53: [002] Can fetch data using persistent connection! Data = '1'
54: done!
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>