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