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