Annotation of embedaddon/php/ext/mysql/tests/mysql_info.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: mysql_info()
3: --SKIPIF--
4: <?php
5: require_once('skipif.inc');
6: require_once('skipifconnectfailure.inc');
7: ?>
8: --FILE--
9: <?php
10: include "connect.inc";
11:
12: if (false !== ($tmp = @mysql_info()))
13: printf("[001] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
14:
15: if (NULL !== ($tmp = @mysql_info(NULL)))
16: printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
17:
18: require "table.inc";
19: if (!$res = mysql_query("INSERT INTO test(id, label) VALUES (100, 'a')", $link))
20: printf("[003] [%d] %s\n", mysql_errno($link), mysql_error($link));
21:
22: if (false !== ($tmp = mysql_info($link)))
23: printf("[004] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
24:
25: if (!$res = mysql_query("INSERT INTO test(id, label) VALUES (101, 'a'), (102, 'b')", $link))
26: printf("[005] [%d] %s\n", mysql_errno($link), mysql_error($link));
27:
28: if (!is_string($tmp = mysql_info($link)) || ('' == $tmp))
29: printf("[006] Expecting string/any_non_empty, got %s/%s\n", gettype($tmp), $tmp);
30:
31: if (!$res = mysql_query('INSERT INTO test(id, label) SELECT id + 200, label FROM test', $link))
32: printf("[007] [%d] %s\n", mysql_errno($link), mysql_error($link));
33:
34: if (!is_string($tmp = mysql_info($link)) || ('' == $tmp))
35: printf("[008] Expecting string/any_non_empty, got %s/%s\n", gettype($tmp), $tmp);
36:
37: if (!$res = mysql_query('ALTER TABLE test MODIFY label CHAR(2)', $link))
38: printf("[009] [%d] %s\n", mysql_errno($link), mysql_error($link));
39:
40: if (!is_string($tmp = mysql_info($link)) || ('' == $tmp))
41: printf("[010] Expecting string/any_non_empty, got %s/%s\n", gettype($tmp), $tmp);
42:
43: if (!$res = mysql_query("UPDATE test SET label = 'b' WHERE id >= 100", $link))
44: printf("[011] [%d] %s\n", mysql_errno($link), mysql_error($link));
45:
46: if (!is_string($tmp = mysql_info($link)) || ('' == $tmp))
47: printf("[012] Expecting string/any_non_empty, got %s/%s\n", gettype($tmp), $tmp);
48:
49: if ((version_compare(PHP_VERSION, '5.9.9', '>') == 1) && !is_unicode($tmp)) {
50: printf("[013] Expecting Unicode!\n");
51: var_inspect($info);
52: }
53:
54: if (!is_string($def_tmp = mysql_info()) || ('' == $def_tmp))
55: printf("[014] Expecting string/any_non_empty, got %s/%s\n", gettype($def_tmp), $def_tmp);
56:
57: if ($def_tmp !== $tmp) {
58: printf("[015] Results differ for default link and specified link, [%d] %s\n",
59: mysql_errno(), mysql_error());
60: var_inspect($tmp);
61: var_inspect($def_tmp);
62: }
63:
64: // NOTE: no LOAD DATA INFILE test
65:
66: print "done!";
67: ?>
68: --CLEAN--
69: <?php
70: require_once("clean_table.inc");
71: ?>
72: --EXPECTF--
73: done!
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>