xref: /PHP-5.3/ext/mysql/tests/mysql_list_dbs.phpt (revision cad4c345)
1--TEST--
2mysql_list_dbs()
3--SKIPIF--
4<?php
5require_once('skipif.inc');
6require_once('skipifconnectfailure.inc');
7?>
8--FILE--
9<?php
10include_once "connect.inc";
11
12$tmp    = NULL;
13$link   = NULL;
14
15if (NULL !== ($tmp = @mysql_list_dbs(NULL)))
16	printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
17
18if (NULL !== ($tmp = @mysql_list_dbs($link, $link)))
19	printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
20
21require('table.inc');
22
23if (!$res = @mysql_list_dbs($link))
24	printf("[003] [%d] %s\n", mysql_errno($link), mysql_error($link));
25
26if (!$num = mysql_num_rows($res))
27	printf("[004] Empty database list? [%d] %s\n", mysql_errno($link), mysql_error($link));
28
29$row = mysql_fetch_array($res, MYSQL_NUM);
30if ((version_compare(PHP_VERSION, '5.9.9', '>') == 1) && !is_unicode($row[0])) {
31	printf("[005] Check for unicode support\n");
32	var_inspect($row);
33}
34
35mysql_free_result($res);
36
37if (!$res2 = @mysql_list_dbs())
38	printf("[006] [%d] %s\n", mysql_errno(), mysql_error());
39
40$row2 = mysql_fetch_array($res2, MYSQL_NUM);
41mysql_free_result($res2);
42
43assert($row === $row2);
44
45mysql_close($link);
46
47print "done!\n";
48?>
49--CLEAN--
50<?php
51require_once("clean_table.inc");
52?>
53--EXPECTF--
54done!