Annotation of embedaddon/php/ext/mysqli/tests/mysqli_errno_oo.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: $mysqli->errno
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: if (0 !== ($tmp = @$mysqli->errno))
18: printf("[001] Expecting int/0, got %s/%s\n", gettype($tmp), $tmp);
19:
20: if (!$mysqli = new mysqli($host, $user, $passwd, $db, $port, $socket))
21: printf("[002] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
22: $host, $user, $db, $port, $socket);
23:
24: var_dump($mysqli->errno);
25:
26: if (!$mysqli->query('DROP TABLE IF EXISTS test')) {
27: printf("[003] Failed to drop old test table: [%d] %s\n", $mysqli->errno, $mysqli->error);
28: }
29:
30: $mysqli->query('SELECT * FROM test');
31: var_dump($mysqli->errno);
32:
33: @$mysqli->query('No SQL');
34: if (($tmp = $mysqli->errno) === 0)
35: printf("[004] Expecting int/any non zero got %s/%s\n", gettype($tmp), $tmp);
36:
37: $mysqli->close();
38:
39: var_dump($mysqli->errno);
40:
41: print "done!";
42: ?>
43: --EXPECTF--
44: int(0)
45: int(%d)
46:
47: Warning: main(): Couldn't fetch mysqli in %s on line %d
48: NULL
49: done!
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>