Annotation of embedaddon/php/ext/mysqli/tests/mysqli_free_result.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: mysqli_free_result()
! 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: $db = 'test';
! 14: $tmp = NULL;
! 15: $link = NULL;
! 16:
! 17: if (!is_null($tmp = @mysqli_free_result()))
! 18: printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
! 19:
! 20: if (!is_null($tmp = @mysqli_free_result($link)))
! 21: printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
! 22:
! 23: require('table.inc');
! 24: if (!$res = mysqli_query($link, "SELECT id FROM test ORDER BY id LIMIT 1")) {
! 25: printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
! 26: }
! 27:
! 28: print "a\n";
! 29: var_dump(mysqli_free_result($res));
! 30: print "b\n";
! 31: var_dump(mysqli_free_result($res));
! 32:
! 33: if (!$res = mysqli_query($link, "SELECT id FROM test ORDER BY id LIMIT 1")) {
! 34: printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
! 35: }
! 36: print "c\n";
! 37: var_dump($res = mysqli_store_result($link));
! 38: var_dump(mysqli_error($link));
! 39: print "[005]\n";
! 40: var_dump(mysqli_free_result($res));
! 41:
! 42: if (!$res = mysqli_query($link, "SELECT id FROM test ORDER BY id LIMIT 1")) {
! 43: printf("[006] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
! 44: }
! 45: print "d\n";
! 46: var_dump($res = mysqli_use_result($link));
! 47: var_dump(mysqli_error($link));
! 48: print "[007]\n";
! 49: var_dump(mysqli_free_result($res));
! 50:
! 51: mysqli_close($link);
! 52: print "done!";
! 53: ?>
! 54: --CLEAN--
! 55: <?php
! 56: require_once("clean_table.inc");
! 57: ?>
! 58: --EXPECTF--
! 59: a
! 60: NULL
! 61: b
! 62:
! 63: Warning: mysqli_free_result(): Couldn't fetch mysqli_result in %s on line %d
! 64: NULL
! 65: c
! 66: bool(false)
! 67: %s(0) ""
! 68: [005]
! 69:
! 70: Warning: mysqli_free_result() expects parameter 1 to be mysqli_result, boolean given in %s on line %d
! 71: NULL
! 72: d
! 73: bool(false)
! 74: %s(0) ""
! 75: [007]
! 76:
! 77: Warning: mysqli_free_result() expects parameter 1 to be mysqli_result, boolean given in %s on line %d
! 78: NULL
! 79: done!
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>