Annotation of embedaddon/php/ext/mysqli/tests/060.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: mysqli_fetch_object with classes
3: --SKIPIF--
4: <?php
5: require_once('skipif.inc');
6: require_once('skipifconnectfailure.inc');
7: ?>
8: --FILE--
9: <?php
10: require_once("connect.inc");
11:
12: class test_class {
13: function __construct($arg1, $arg2) {
14: echo __METHOD__ . "($arg1,$arg2)\n";
15: }
16: }
17:
18: /*** test mysqli_connect 127.0.0.1 ***/
19: $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
20:
21: mysqli_select_db($link, $db);
22: mysqli_query($link, "SET sql_mode=''");
23:
24: mysqli_query($link,"DROP TABLE IF EXISTS test_fetch");
25: mysqli_query($link,"CREATE TABLE test_fetch(c1 smallint unsigned,
26: c2 smallint unsigned,
27: c3 smallint,
28: c4 smallint,
29: c5 smallint,
30: c6 smallint unsigned,
31: c7 smallint)");
32:
33: mysqli_query($link, "INSERT INTO test_fetch VALUES ( -23, 35999, NULL, -500, -9999999, -0, 0)");
34:
35: $result = mysqli_query($link, "SELECT * FROM test_fetch");
36: $test = mysqli_fetch_object($result, 'test_class', array(1, 2));
37: mysqli_free_result($result);
38:
39: var_dump($test);
40:
41: mysqli_close($link);
42:
43: echo "Done\n";
44: ?>
45: --CLEAN--
46: <?php
47: require_once("connect.inc");
48: if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
49: printf("[c001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
50:
51: if (!mysqli_query($link, "DROP TABLE IF EXISTS test_fetch"))
52: printf("[c002] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
53:
54: mysqli_close($link);
55: ?>
56: --EXPECTF--
57: test_class::__construct(1,2)
58: object(test_class)#%d (7) {
59: [%u|b%"c1"]=>
60: %unicode|string%(1) "0"
61: [%u|b%"c2"]=>
62: %unicode|string%(5) "35999"
63: [%u|b%"c3"]=>
64: NULL
65: [%u|b%"c4"]=>
66: %unicode|string%(4) "-500"
67: [%u|b%"c5"]=>
68: %unicode|string%(6) "-32768"
69: [%u|b%"c6"]=>
70: %unicode|string%(1) "0"
71: [%u|b%"c7"]=>
72: %unicode|string%(1) "0"
73: }
74: Done
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>