Annotation of embedaddon/php/ext/mysql/tests/mysql_db_query.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: mysql_db_query()
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: // NOTE: this function is deprecated. We do only the most necessary
13: // to test it. We don't test all aspects of the documented behaviour.
14:
15: $tmp = NULL;
16: $link = NULL;
17:
18: if (NULL !== ($tmp = @mysql_db_query()))
19: printf("[001] Expecting NULL/NULL, got %s/%s\n", gettype($tmp), $tmp);
20:
21: if (NULL !== ($tmp = @mysql_db_query($link)))
22: printf("[002] Expecting NULL/NULL, got %s/%s\n", gettype($tmp), $tmp);
23:
24: if (NULL !== ($tmp = @mysql_db_query($link)))
25: printf("[003] Expecting NULL/NULL, got %s/%s\n", gettype($tmp), $tmp);
26:
27: require('table.inc');
28: if (!$res = @mysql_db_query($db, 'SELECT id, label FROM test ORDER BY id LIMIT 1', $link))
29: printf("[004] [%d] %s\n", mysql_errno($link), mysql_error($link));
30:
31: $row = mysql_fetch_assoc($res);
32: if (1 != $row['id'])
33: printf("[005] Expecting record 1/a, got record %s/%s\n", $row['id'], $row['label']);
34:
35: if ((version_compare(PHP_VERSION, '5.9.9', '>') == 1) && !is_unicode($row['label'])) {
36: printf("[006] No unicode returned! [%d] %s\n", mysql_errno($link), mysql_error($link));
37: var_inspect($row);
38: }
39:
40: mysql_free_result($res);
41:
42:
43: if (!$res = @mysql_db_query($db, 'SELECT id, label FROM test ORDER BY id LIMIT 1'))
44: printf("[007] [%d] %s\n", mysql_errno(), mysql_error());
45:
46: $row = mysql_fetch_assoc($res);
47: if (1 != $row['id'])
48: printf("[008] Expecting record 1/a, got record %s/%s\n", $row['id'], $row['label']);
49:
50: if ((version_compare(PHP_VERSION, '5.9.9', '>') == 1) && !is_unicode($row['label'])) {
51: printf("[009] No unicode returned! [%d] %s\n", mysql_errno(), mysql_error());
52: var_inspect($row);
53: }
54:
55: mysql_free_result($res);
56: mysql_close($link);
57:
58: print "done!\n";
59: ?>
60: --CLEAN--
61: <?php
62: require_once("clean_table.inc");
63: ?>
64: --EXPECTF--
65: done!
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>