Annotation of embedaddon/php/ext/mysqli/tests/mysqli_fetch_field_direct_oo.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: $res->fetch_field_direct(s)
3: --SKIPIF--
4: <?php
5: require_once('skipif.inc');
6: require_once('skipifemb.inc');
7: require_once('skipifconnectfailure.inc');
8: ?>
9: --FILE--
10: <?php
11: require_once("connect.inc");
12:
13: $tmp = NULL;
14: $link = NULL;
15:
16: $mysqli = new mysqli();
17: $res = @new mysqli_result($mysqli);
18: if (!is_null($tmp = @$res->fetch_field_direct()))
19: printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
20:
21: require('table.inc');
22:
23: if (!$mysqli = new my_mysqli($host, $user, $passwd, $db, $port, $socket))
24: printf("[002] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
25: $host, $user, $db, $port, $socket);
26:
27: if (!$res = $mysqli->query("SELECT id AS ID, label FROM test AS TEST ORDER BY id LIMIT 1")) {
28: printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
29: }
30:
31: if (!is_null($tmp = @$res->fetch_field_direct()))
32: printf("[004] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
33:
34: if (!is_null($tmp = @$res->fetch_field_direct($link)))
35: printf("[005] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
36:
37: if (!is_null($tmp = @$res->fetch_field_direct($link, $link)))
38: printf("[006] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
39:
40: var_dump($res->fetch_field_direct(-1));
41: var_dump($res->fetch_field_direct(0));
42: var_dump($res->fetch_field_direct(2));
43:
44: $res->free_result();
45:
46: if (NULL !== ($tmp = $res->fetch_field_direct(0)))
47: printf("[007] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
48:
49: $mysqli->close();
50: print "done!";
51: ?>
52: --CLEAN--
53: <?php
54: require_once("clean_table.inc");
55: ?>
56: --EXPECTF--
57: Warning: mysqli_result::fetch_field_direct(): Field offset is invalid for resultset in %s on line %d
58: bool(false)
59: object(stdClass)#%d (13) {
60: [%u|b%"name"]=>
61: %unicode|string%(2) "ID"
62: [%u|b%"orgname"]=>
63: %unicode|string%(2) "id"
64: [%u|b%"table"]=>
65: %unicode|string%(4) "TEST"
66: [%u|b%"orgtable"]=>
67: %unicode|string%(%d) "%s"
68: [%u|b%"def"]=>
69: %unicode|string%(0) ""
70: [%u|b%"db"]=>
71: %unicode|string%(%d) "%s"
72: [%u|b%"catalog"]=>
73: %unicode|string%(%d) "%s"
74: [%u|b%"max_length"]=>
75: int(%d)
76: [%u|b%"length"]=>
77: int(11)
78: [%u|b%"charsetnr"]=>
79: int(%d)
80: [%u|b%"flags"]=>
81: int(%d)
82: [%u|b%"type"]=>
83: int(%d)
84: [%u|b%"decimals"]=>
85: int(%d)
86: }
87:
88: Warning: mysqli_result::fetch_field_direct(): Field offset is invalid for resultset in %s on line %d
89: bool(false)
90:
91: Warning: mysqli_result::fetch_field_direct(): Couldn't fetch mysqli_result in %s on line %d
92: done!
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>