Annotation of embedaddon/php/ext/mysql/tests/mysql_free_result.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: mysql_free_result()
! 3: --SKIPIF--
! 4: <?php
! 5: require_once('skipif.inc');
! 6: require_once('skipifconnectfailure.inc');
! 7: ?>
! 8: --FILE--
! 9: <?php
! 10: include "connect.inc";
! 11:
! 12: $tmp = NULL;
! 13: $link = NULL;
! 14:
! 15: if (!is_null($tmp = @mysql_free_result()))
! 16: printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
! 17:
! 18: if (null !== ($tmp = @mysql_free_result($link)))
! 19: printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
! 20:
! 21: require('table.inc');
! 22: if (!$res = mysql_query("SELECT id FROM test ORDER BY id LIMIT 1", $link)) {
! 23: printf("[003] [%d] %s\n", mysql_errno($link), mysql_error($link));
! 24: }
! 25:
! 26: var_dump(mysql_free_result($res));
! 27: var_dump(mysql_free_result($res));
! 28:
! 29: if ($tmp = sys_get_temp_dir()) {
! 30: $tmpname = tempnam($tmp, 'free_result');
! 31: if ($fp = fopen($tmpname, 'w')) {
! 32: if (false !== ($tmp = @mysql_free_result($fp)))
! 33: printf("[004] Expecting boolean/false got %s/%s\n", gettype($tmp), $tmp);
! 34: fclose($fp);
! 35: @unlink($tmpname);
! 36: }
! 37: }
! 38:
! 39: mysql_close($link);
! 40: print "done!";
! 41: ?>
! 42: --CLEAN--
! 43: <?php
! 44: require_once("clean_table.inc");
! 45: ?>
! 46: --EXPECTF--
! 47: bool(true)
! 48:
! 49: Warning: mysql_free_result(): %d is not a valid MySQL result resource in %s on line %d
! 50: bool(false)
! 51: done!
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>