Annotation of embedaddon/php/ext/mysqli/tests/mysqli_fetch_field_direct.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: mysqli_fetch_field_direct()
! 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_fetch_field_direct()))
! 17: printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
! 18:
! 19: if (!is_null($tmp = @mysqli_fetch_field_direct($link)))
! 20: printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
! 21:
! 22: if (!is_null($tmp = @mysqli_fetch_field_direct($link, $link)))
! 23: printf("[003] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
! 24:
! 25: require('table.inc');
! 26:
! 27: if (!$res = mysqli_query($link, "SELECT id AS ID, label FROM test AS TEST ORDER BY id LIMIT 1")) {
! 28: printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
! 29: }
! 30:
! 31: var_dump(mysqli_fetch_field_direct($res, -1));
! 32: var_dump(mysqli_fetch_field_direct($res, 0));
! 33: var_dump(mysqli_fetch_field_direct($res, 2));
! 34:
! 35: mysqli_free_result($res);
! 36:
! 37: if (NULL !== ($tmp = mysqli_fetch_field_direct($res, 0)))
! 38: printf("Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
! 39:
! 40: mysqli_close($link);
! 41: print "done!";
! 42: ?>
! 43: --CLEAN--
! 44: <?php
! 45: require_once("clean_table.inc");
! 46: ?>
! 47: --EXPECTF--
! 48: Warning: mysqli_fetch_field_direct(): Field offset is invalid for resultset in %s on line %d
! 49: bool(false)
! 50: object(stdClass)#%d (13) {
! 51: [%u|b%"name"]=>
! 52: %unicode|string%(2) "ID"
! 53: [%u|b%"orgname"]=>
! 54: %unicode|string%(2) "id"
! 55: [%u|b%"table"]=>
! 56: %unicode|string%(4) "TEST"
! 57: [%u|b%"orgtable"]=>
! 58: %unicode|string%(4) "test"
! 59: [%u|b%"def"]=>
! 60: %unicode|string%(0) ""
! 61: [%u|b%"db"]=>
! 62: %unicode|string%(%d) "%s"
! 63: [%u|b%"catalog"]=>
! 64: %unicode|string%(%d) "%s"
! 65: [%u|b%"max_length"]=>
! 66: int(%d)
! 67: [%u|b%"length"]=>
! 68: int(%d)
! 69: [%u|b%"charsetnr"]=>
! 70: int(%d)
! 71: [%u|b%"flags"]=>
! 72: int(%d)
! 73: [%u|b%"type"]=>
! 74: int(%d)
! 75: [%u|b%"decimals"]=>
! 76: int(%d)
! 77: }
! 78:
! 79: Warning: mysqli_fetch_field_direct(): Field offset is invalid for resultset in %s on line %d
! 80: bool(false)
! 81:
! 82: Warning: mysqli_fetch_field_direct(): Couldn't fetch mysqli_result in %s on line %d
! 83: done!
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>