cvs: php-src(PHP_5_3) /ext/mysql/tests mysql_list_dbs.phpt mysql_list_fields.phpt mysql_list_processes.phpt mysql_list_tables.phpt mysql_query.phpt
mysql_query_load_data_openbasedir.phpt mysql_real_escape_string.phpt mysql_result.phpt mysql_select_db.phpt mysql_set_charset.phpt
mysql_sql_safe_mode.phpt mysql_stat.phpt mysql_tablename.phpt mysql_thread_id.phpt mysql_trace_mode.phpt mysql_unbuffered_query.phpt

From: Date: Wed, 10 Oct 2007 09:56:48 +0000
Subject: cvs: php-src(PHP_5_3) /ext/mysql/tests mysql_list_dbs.phpt mysql_list_fields.phpt mysql_list_processes.phpt mysql_list_tables.phpt mysql_query.phpt
mysql_query_load_data_openbasedir.phpt mysql_real_escape_string.phpt mysql_result.phpt mysql_select_db.phpt mysql_set_charset.phpt
mysql_sql_safe_mode.phpt mysql_stat.phpt mysql_tablename.phpt mysql_thread_id.phpt mysql_trace_mode.phpt mysql_unbuffered_query.phpt
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-46591@lists.php.net to get a copy of this message
uw Wed Oct 10 09:56:48 2007 UTC Added files: (Branch: PHP_5_3) /php-src/ext/mysql/tests mysql_list_dbs.phpt mysql_list_fields.phpt mysql_list_processes.phpt mysql_list_tables.phpt mysql_query.phpt mysql_query_load_data_openbasedir.phpt mysql_real_escape_string.phpt mysql_result.phpt mysql_select_db.phpt mysql_set_charset.phpt mysql_sql_safe_mode.phpt mysql_stat.phpt mysql_tablename.phpt mysql_thread_id.phpt mysql_trace_mode.phpt mysql_unbuffered_query.phpt Log: And the last set of new tests for ext/mysql. "new" does not really mean new. We've checked them into HEAD/PHP6 before already.

http://cvs.php.net/viewvc.cgi/php-src/ext/mysql/tests/mysql_list_dbs.phpt?view=markup&rev=1.1 Index: php-src/ext/mysql/tests/mysql_list_dbs.phpt +++ php-src/ext/mysql/tests/mysql_list_dbs.phpt --TEST-- mysql_list_dbs() --SKIPIF-- <?php require_once('skipif.inc'); ?> --FILE-- <?php include_once "connect.inc"; $tmp = NULL; $link = NULL; if (false !== ($tmp = @mysql_list_dbs(NULL))) printf("[001] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp); if (NULL !== ($tmp = @mysql_list_dbs($link, $link))) printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); require('table.inc'); if (!$res = mysql_list_dbs($link)) printf("[003] [%d] %s\n", mysql_errno($link), mysql_error($link)); if (!$num = mysql_num_rows($res)) printf("[004] Empty database list? [%d] %s\n", mysql_errno($link), mysql_error($link)); $row = mysql_fetch_array($res, MYSQL_NUM); if (ini_get('unicode.semantics') && !is_unicode($row[0])) { printf("[005] Check for unicode support\n"); var_inspect($row); } mysql_free_result($res); mysql_close($link); print "done!\n"; ?> --EXPECTF-- done! http://cvs.php.net/viewvc.cgi/php-src/ext/mysql/tests/mysql_list_fields.phpt?view=markup&rev=1.1 Index: php-src/ext/mysql/tests/mysql_list_fields.phpt +++ php-src/ext/mysql/tests/mysql_list_fields.phpt --TEST-- mysql_list_fields() --SKIPIF-- <?php require_once('skipif.inc'); ?> --FILE-- <?php include_once "connect.inc"; $tmp = NULL; $link = NULL; if (false !== ($tmp = @mysql_list_fields($link, $link))) printf("[002] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp); require('table.inc'); if (!$res = mysql_list_fields($db, 'test', $link)) printf("[003] [%d] %s\n", mysql_errno($link), mysql_error($link)); if (!($num = mysql_num_fields($res))) printf("[004] Empty field list? [%d] %s\n", mysql_errno($link), mysql_error($link)); mysql_free_result($res); mysql_close($link); print "done!\n"; ?> --EXPECTF-- done! http://cvs.php.net/viewvc.cgi/php-src/ext/mysql/tests/mysql_list_processes.phpt?view=markup&rev=1.1 Index: php-src/ext/mysql/tests/mysql_list_processes.phpt +++ php-src/ext/mysql/tests/mysql_list_processes.phpt --TEST-- mysql_list_processes() --SKIPIF-- <?php require_once('skipif.inc'); ?> --FILE-- <?php include "connect.inc"; $tmp = NULL; $link = NULL; if (NULL !== ($tmp = @mysql_list_processes($link, $link))) printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); require('table.inc'); if (!$res = mysql_list_processes($link)) printf("[002] [%d] %s\n", mysql_errno($link), mysql_error($link)); if (!$num = mysql_num_rows($res)) printf("[003] Empty process list? [%d] %s\n", mysql_errno($link), mysql_error($link)); $row = mysql_fetch_array($res, MYSQL_NUM); if (ini_get('unicode.semantics') && !is_unicode($row[0])) { printf("[004] Check for unicode support\n"); var_inspect($row); } mysql_free_result($res); mysql_close($link); print "done!\n"; ?> --EXPECTF-- done! http://cvs.php.net/viewvc.cgi/php-src/ext/mysql/tests/mysql_list_tables.phpt?view=markup&rev=1.1 Index: php-src/ext/mysql/tests/mysql_list_tables.phpt +++ php-src/ext/mysql/tests/mysql_list_tables.phpt --TEST-- mysql_list_tables() --SKIPIF-- <?php require_once('skipif.inc'); ?> --FILE-- <?php include_once "connect.inc"; $tmp = NULL; $link = NULL; if (NULL !== ($tmp = @mysql_list_tables())) printf("[001] Expecting NULL got %s/%s\n", gettype($tmp), $tmp); if (NULL !== ($tmp = @mysql_list_tables('too', 'many', 'arguments'))) printf("[002] Expecting NULL got %s/%s\n", gettype($tmp), $tmp); if (false !== ($tmp = @mysql_list_tables(NULL))) printf("[003] Expecting boolean/false got %s/%s\n", gettype($tmp), $tmp); if (false !== ($tmp = @mysql_list_tables($db, NULL))) printf("[004] Expecting boolean/false got %s/%s\n", gettype($tmp), $tmp); require_once('table.inc'); if (!$res_def = @mysql_list_tables($db)) printf("[005] [%d] %s\n", mysql_errno(), mysql_error()); if (!$res = @mysql_list_tables($db, $link)) printf("[006] [%d] %s\n", mysql_errno($link), mysql_error($link)); if (!$res_query = mysql_query("SHOW TABLES", $link)) printf("[007] [%d] %s\n", mysql_errno($link), mysql_error($link)); $tables_def = $tables = $tables_query = array(); while ($row = mysql_fetch_assoc($res_def)) $tables_def[] = $row; mysql_free_result($res_def); while ($row = mysql_fetch_assoc($res)) $tables[] = $row; mysql_free_result($res); while ($row = mysql_fetch_assoc($res_query)) $tables_query[] = $row; mysql_free_result($res_query); if ($tables_def !== $tables) { printf("[008] Got different table lists for default link and specified link\n"); var_dump($tables_def); var_dump($tables); } $list1 = $list2 = array(); foreach ($tables as $k => $tlist) foreach ($tlist as $k => $table) $list1[] = $table; foreach ($tables_query as $k => $tlist) foreach ($tlist as $k => $table) $list2[] = $table; if ($list1 !== $list2) { printf("[009] Got different results for mysql_list_tables() and SHOW TABLES\n"); var_dump($list1); var_dump($list2); } if (!in_array('test', $list1)) printf("[010] Table lists seem to be wrong. Check manually.\n"); mysql_close($link); print "done!\n"; ?> --EXPECTF-- done! http://cvs.php.net/viewvc.cgi/php-src/ext/mysql/tests/mysql_query.phpt?view=markup&rev=1.1 Index: php-src/ext/mysql/tests/mysql_query.phpt +++ php-src/ext/mysql/tests/mysql_query.phpt --TEST-- mysql_query() --SKIPIF-- <?php require_once('skipif.inc'); ?> <?php require_once('skipifemb.inc'); ?> --FILE-- <?php include "connect.inc"; $tmp = NULL; $link = NULL; if (!is_null($tmp = @mysql_query())) printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); if (false !== ($tmp = @mysql_query($link))) printf("[002] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp); require('table.inc'); if (NULL !== ($tmp = @mysql_query("SELECT 1 AS a", $link, "foo"))) printf("[003] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); if (false !== ($tmp = mysql_query('THIS IS NOT SQL', $link))) printf("[004] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp); if (false !== ($tmp = mysql_query('SELECT "this is sql but with backslash g"\g', $link))) printf("[005] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp); if ((0 === mysql_errno($link)) || ('' == mysql_error($link))) printf("[006] mysql_errno()/mysql_error should return some error\n"); if (!$res = mysql_query('SELECT "this is sql but with semicolon" AS valid ; ', $link)) printf("[007] [%d] %s\n", mysql_errno($link), mysql_error($link)); var_dump(mysql_fetch_assoc($res)); mysql_free_result($res); if (false !== ($res = mysql_query('SELECT "this is sql but with semicolon" AS valid ; SHOW VARIABLES', $link))) printf("[008] [%d] %s\n", mysql_errno($link), mysql_error($link)); if (mysql_query('DROP PROCEDURE IF EXISTS p', $link)) { // let's try to play with stored procedures if (mysql_query('CREATE PROCEDURE p(OUT ver_param VARCHAR(25)) BEGIN SELECT VERSION() INTO ver_param; END;', $link)) { $res = mysql_query('CALL p(@version)', $link); $res = mysql_query('SELECT @version AS p_version', $link); var_dump(mysql_fetch_assoc($res)); mysql_free_result($res); } else { printf("[009] [%d] %s\n", mysql_errno($link), mysql_error($link)); } mysql_query('DROP FUNCTION IF EXISTS f', $link); if (mysql_query('CREATE FUNCTION f( ver_param VARCHAR(25)) RETURNS VARCHAR(25) DETERMINISTIC RETURN ver_param;', $link)) { $res = mysql_query('SELECT f(VERSION()) AS f_version', $link); var_dump(mysql_fetch_assoc($res)); mysql_free_result($res); } else { printf("[010] [%d] %s\n", mysql_errno($link), mysql_error($link)); } } mysql_close($link); if (false !== ($tmp = mysql_query("SELECT id FROM test", $link))) printf("[011] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp); print "done!"; ?> --EXPECTF-- array(1) { ["valid"]=> string(30) "this is sql but with semicolon" } array(1) { ["p_version"]=> string(%d) "%s" } array(1) { ["f_version"]=> string(%d) "%s" } Warning: mysql_query(): %d is not a valid MySQL-Link resource in %s on line %d done! --UEXPECTF-- array(1) { [u"valid"]=> unicode(30) "this is sql but with semicolon" } array(1) { [u"p_version"]=> unicode(%d) "%s" } array(1) { [u"f_version"]=> unicode(%d) "%s" } Warning: mysql_query(): %d is not a valid MySQL-Link resource in %s on line %d done! http://cvs.php.net/viewvc.cgi/php-src/ext/mysql/tests/mysql_query_load_data_openbasedir.phpt?view=markup&rev=1.1 Index: php-src/ext/mysql/tests/mysql_query_load_data_openbasedir.phpt +++ php-src/ext/mysql/tests/mysql_query_load_data_openbasedir.phpt http://cvs.php.net/viewvc.cgi/php-src/ext/mysql/tests/mysql_real_escape_string.phpt?view=markup&rev=1.1 Index: php-src/ext/mysql/tests/mysql_real_escape_string.phpt +++ php-src/ext/mysql/tests/mysql_real_escape_string.phpt --TEST-- mysql_real_escape_string() --SKIPIF-- <?php require_once('skipif.inc'); ?> <?php require_once('skipifemb.inc'); ?> --FILE-- <?php include "connect.inc"; $tmp = NULL; $link = NULL; if (NULL !== ($tmp = @mysql_real_escape_string())) printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); require('table.inc'); var_dump(mysql_real_escape_string("Am I a unicode string in PHP 6?", $link)); var_dump(mysql_real_escape_string('\\', $link)); var_dump(mysql_real_escape_string('"', $link)); var_dump(mysql_real_escape_string("'", $link)); var_dump(mysql_real_escape_string("\n", $link)); var_dump(mysql_real_escape_string("\r", $link)); var_dump(mysql_real_escape_string("foo" . chr(0) . "bar", $link)); print "done!"; ?> --EXPECTF-- string(31) "Am I a unicode string in PHP 6?" string(2) "\\" string(2) "\"" string(2) "\'" string(2) "\n" string(2) "\r" string(8) "foo\0bar" done! --UEXPECTF-- unicode(31) "Am I a unicode string in PHP 6?" unicode(2) "\\" unicode(2) "\"" unicode(2) "\'" unicode(2) "\n" unicode(2) "\r" unicode(8) "foo\0bar" done! http://cvs.php.net/viewvc.cgi/php-src/ext/mysql/tests/mysql_result.phpt?view=markup&rev=1.1 Index: php-src/ext/mysql/tests/mysql_result.phpt +++ php-src/ext/mysql/tests/mysql_result.phpt --TEST-- mysql_result() --SKIPIF-- <?php require_once('skipif.inc'); ?> <?php require_once('skipifemb.inc'); ?> --FILE-- <?php include "connect.inc"; $tmp = NULL; $link = NULL; // string mysql_result ( resource result, int row [, mixed field] ) if (!is_null($tmp = @mysql_result())) printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); if (!is_null($tmp = @mysql_result($link))) printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); require('table.inc'); if (!$res = mysql_query("SELECT id, label FROM test ORDER BY id LIMIT 1", $link)) { printf("[003] [%d] %s\n", mysql_errno($link), mysql_error($link)); } var_dump(mysql_result($res, -1)); var_dump(mysql_result($res, 2)); var_dump(mysql_result($res, 0, -1)); var_dump(mysql_result($res, 0, 2)); var_dump(mysql_result($res, 0)); var_dump(mysql_result($res, 0, 1)); mysql_free_result($res); var_dump(mysql_result($res, 0)); mysql_close($link); print "done!"; ?> --EXPECTF-- Warning: mysql_result(): Unable to jump to row -1 on MySQL result index %d in %s on line %d bool(false) Warning: mysql_result(): Unable to jump to row 2 on MySQL result index %d in %s on line %d bool(false) Warning: mysql_result(): Bad column offset specified in %s on line %d bool(false) Warning: mysql_result(): Bad column offset specified in %s on line %d bool(false) string(1) "1" string(1) "a" Warning: mysql_result(): %d is not a valid MySQL result resource in %s on line %d bool(false) done! --UEXPECTF-- Warning: mysql_result(): Unable to jump to row -1 on MySQL result index %d in %s on line %d bool(false) Warning: mysql_result(): Unable to jump to row 2 on MySQL result index %d in %s on line %d bool(false) Warning: mysql_result(): Bad column offset specified in %s on line %d bool(false) Warning: mysql_result(): Bad column offset specified in %s on line %d bool(false) unicode(1) "1" unicode(1) "a" Warning: mysql_result(): %d is not a valid MySQL result resource in %s on line %d bool(false) done! http://cvs.php.net/viewvc.cgi/php-src/ext/mysql/tests/mysql_select_db.phpt?view=markup&rev=1.1 Index: php-src/ext/mysql/tests/mysql_select_db.phpt +++ php-src/ext/mysql/tests/mysql_select_db.phpt --TEST-- mysql_select_db() --SKIPIF-- <?php require_once('skipif.inc'); ?> --FILE-- <?php include_once "connect.inc"; $tmp = NULL; $link = NULL; if (false !== ($tmp = @mysql_select_db($link))) printf("[001] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp); if (!$link = my_mysql_connect($host, $user, $passwd, $db, $port, $socket)) printf("[002] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", $host, $user, $db, $port, $socket); if (!is_null($tmp = @mysql_select_db($db, $link, "foo"))) printf("[003] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); /* does not make too much sense, unless we have access to at least one more database than $db */ if (!mysql_select_db($db, $link)) printf("[004] Cannot select DB %s, [%d] %s\n", $db, mysql_errno($link), mysql_error($link)); if (!$res = mysql_query("SELECT DATABASE() AS dbname", $link)) printf("[005] [%d] %s\n", mysql_errno($link), mysql_error($link)); if (!$row = mysql_fetch_assoc($res)) printf("[006] [%d] %s\n", mysql_errno($link), mysql_error($link)); if ($row['dbname'] !== (string)$db) printf("[007] Expecting database '%s', found '%s'\n", $db, $row['dbname']); var_dump($row['dbname']); mysql_free_result($res); if (mysql_select_db('mysql', $link)) { // Yippie, a second database to play with - that's great because mysql_select_db // ($db) was done by mysql__connect() already and the previous test // was quite useless if (!$res = mysql_query("SELECT DATABASE() AS dbname", $link)) printf("[008] [%d] %s\n", mysql_errno($link), mysql_error($link)); if (!$row = mysql_fetch_assoc($res)) printf("[009] [%d] %s\n", mysql_errno($link), mysql_error($link)); if (strtolower($row['dbname']) !== 'mysql') printf("[010] Expecting database 'mysql', found '%s'\n", $row['dbname']); mysql_free_result($res); } var_dump(mysql_select_db('I can not imagine that this database exists', $link)); mysql_close($link); if (false !== ($tmp = mysql_select_db($db, $link))) printf("[012] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp); print "done!\n"; ?> --EXPECTF-- string(7) "phptest" bool(false) Warning: mysql_select_db(): %d is not a valid MySQL-Link resource in %s on line %d done! --UEXPECTF-- unicode(7) "phptest" bool(false) Warning: mysql_select_db(): %d is not a valid MySQL-Link resource in %s on line %d done! http://cvs.php.net/viewvc.cgi/php-src/ext/mysql/tests/mysql_set_charset.phpt?view=markup&rev=1.1 Index: php-src/ext/mysql/tests/mysql_set_charset.phpt +++ php-src/ext/mysql/tests/mysql_set_charset.phpt --TEST-- mysql_set_charset() - STUB, function usage not recommended --SKIPIF-- <?php require_once('skipif.inc'); if (!function_exists('mysql_set_charset')) die("skip Function not available"); ?> --FILE-- <?php include_once "connect.inc"; $tmp = NULL; $link = NULL; if (!is_null($tmp = @mysql_set_charset())) printf("[001] Expecting NULL got %s/%s\n", $tmp, gettype($tmp)); if (false !== ($tmp = @mysql_set_charset($link))) printf("[002] Expecting boolean/false got %s/%s\n", $tmp, gettype($tmp)); if (false !== ($tmp = @mysql_set_charset(-1))) printf("[003] Expecting boolean/false got %s/%s\n", $tmp, gettype($tmp)); if (!is_null($tmp = @mysql_set_charset('somecharset', $link))) printf("[004] Expecting NULL got %s/%s\n", $tmp, gettype($tmp)); if (!$link = my_mysql_connect($host, $user, $passwd, $db, $port, $socket)) printf("[005] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", $host, $user, $db, $port, $socket); /* unicode mode should throw a warning */ $tmp = mysql_set_charset('uFt8', $link); if (ini_get('unicode.semantics')) $expect = false; else $expect = true; $charsets = array('latin1', 'latin2'); foreach ($charsets as $k => $charset) { if (!($res = mysql_query(sprintf('SHOW CHARACTER SET LIKE "%s"', $charset), $link))) continue; mysql_free_result($res); if ($expect !== ($tmp = @mysql_set_charset($charset, $link))) printf("[006] Expecting %s/%s got %s/%s\n", gettype($expect), $expect, gettype($tmp), $tmp); } mysql_close($link); print "done!"; ?> --EXPECTF-- done! --UEXPECTF-- Warning: mysql_set_charset(): Character set %s is not supported when running PHP with unicode.semantics=On. in %s on line %d done! http://cvs.php.net/viewvc.cgi/php-src/ext/mysql/tests/mysql_sql_safe_mode.phpt?view=markup&rev=1.1 Index: php-src/ext/mysql/tests/mysql_sql_safe_mode.phpt +++ php-src/ext/mysql/tests/mysql_sql_safe_mode.phpt http://cvs.php.net/viewvc.cgi/php-src/ext/mysql/tests/mysql_stat.phpt?view=markup&rev=1.1 Index: php-src/ext/mysql/tests/mysql_stat.phpt +++ php-src/ext/mysql/tests/mysql_stat.phpt --TEST-- mysql_stat() --SKIPIF-- <?php require_once('skipif.inc'); ?> --FILE-- <?php include_once "connect.inc"; $dbname = 'test'; $tmp = NULL; $link = NULL; if (!is_null($tmp = @mysql_stat($link))) printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); require('table.inc'); if (!is_null($tmp = @mysql_stat($link, "foo"))) printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); if ((!is_string($tmp = mysql_stat($link))) || ('' === $tmp)) printf("[003] Expecting non empty string, got %s/'%s', [%d] %s\n", gettype($tmp), $tmp, mysql_errno($link), mysql_error($link)); if (ini_get('unicode.semantics') && !is_unicode($tmp)) { printf("[004] Expecting Unicode error message!\n"); var_inspect($tmp); } mysql_close($link); if (false !== ($tmp = mysql_stat($link))) printf("[005] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp); print "done!"; ?> --EXPECTF-- Warning: mysql_stat(): %d is not a valid MySQL-Link resource in %s on line %d done! http://cvs.php.net/viewvc.cgi/php-src/ext/mysql/tests/mysql_tablename.phpt?view=markup&rev=1.1 Index: php-src/ext/mysql/tests/mysql_tablename.phpt +++ php-src/ext/mysql/tests/mysql_tablename.phpt --TEST-- mysql_tablename() --SKIPIF-- <?php require_once('skipif.inc'); ?> <?php require_once('skipifemb.inc'); ?> --FILE-- <?php include "connect.inc"; $tmp = NULL; $link = NULL; if (!is_null($tmp = @mysql_tablename())) printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); if (null !== ($tmp = @mysql_tablename($link))) printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); require('table.inc'); if (!$res = mysql_query("SELECT id, label FROM test ORDER BY id LIMIT 2", $link)) { printf("[003] [%d] %s\n", mysql_errno($link), mysql_error($link)); } if (NULL !== ($tmp = mysql_tablename($res))) printf("[004] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); if (false !== ($tmp = mysql_tablename($res, -1))) printf("[005] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp); var_dump(mysql_tablename($res, 0)); if (false !== ($tmp = mysql_tablename($res, 2))) printf("[00%d] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp); mysql_free_result($res); var_dump(mysql_tablename($res, 0)); mysql_close($link); print "done!"; ?> --EXPECTF-- Warning: Wrong parameter count for mysql_tablename() in %s on line %d Warning: mysql_tablename(): Unable to jump to row -1 on MySQL result index %d in %s on line %d string(1) "1" Warning: mysql_tablename(): Unable to jump to row 2 on MySQL result index %d in %s on line %d Warning: mysql_tablename(): %d is not a valid MySQL result resource in %s on line %d bool(false) done! --UEXPECTF-- Warning: Wrong parameter count for mysql_tablename() in %s on line %d Warning: mysql_tablename(): Unable to jump to row -1 on MySQL result index %d in %s on line %d unicode(1) "1" Warning: mysql_tablename(): Unable to jump to row 2 on MySQL result index %d in %s on line %d Warning: mysql_tablename(): %d is not a valid MySQL result resource in %s on line %d bool(false) done! http://cvs.php.net/viewvc.cgi/php-src/ext/mysql/tests/mysql_thread_id.phpt?view=markup&rev=1.1 Index: php-src/ext/mysql/tests/mysql_thread_id.phpt +++ php-src/ext/mysql/tests/mysql_thread_id.phpt --TEST-- mysql_thread_id() --SKIPIF-- <?php require_once('skipif.inc'); ?> --FILE-- <?php include_once "connect.inc"; $tmp = NULL; $link = NULL; if (!is_null($tmp = @mysql_thread_id($link))) printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); require('table.inc'); if (!is_int($tmp = mysql_thread_id($link)) || (0 === $tmp)) printf("[002] Expecting int/any but zero, got %s/%s. [%d] %s\n", gettype($tmp), $tmp, mysql_errno($link), mysql_error($link)); mysql_close($link); if (false !== ($tmp = mysql_thread_id($link))) printf("[003] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp); print "done!"; ?> --EXPECTF-- Warning: mysql_thread_id(): %d is not a valid MySQL-Link resource in %s on line %d done! http://cvs.php.net/viewvc.cgi/php-src/ext/mysql/tests/mysql_trace_mode.phpt?view=markup&rev=1.1 Index: php-src/ext/mysql/tests/mysql_trace_mode.phpt +++ php-src/ext/mysql/tests/mysql_trace_mode.phpt http://cvs.php.net/viewvc.cgi/php-src/ext/mysql/tests/mysql_unbuffered_query.phpt?view=markup&rev=1.1 Index: php-src/ext/mysql/tests/mysql_unbuffered_query.phpt +++ php-src/ext/mysql/tests/mysql_unbuffered_query.phpt --TEST-- mysql_unbuffered_query() --SKIPIF-- <?php require_once('skipif.inc'); ?> <?php require_once('skipifemb.inc'); ?> --FILE-- <?php include "connect.inc"; $tmp = NULL; $link = NULL; if (false !== ($tmp = @mysql_unbuffered_query($link))) printf("[001] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp); require('table.inc'); if (NULL !== ($tmp = @mysql_unbuffered_query("SELECT 1 AS a", $link, "foo"))) printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); if (false !== ($tmp = mysql_unbuffered_query('THIS IS NOT SQL', $link))) printf("[003] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp); if (false !== ($tmp = mysql_unbuffered_query('SELECT "this is sql but with backslash g"\g', $link))) printf("[004] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp); if ((0 === mysql_errno($link)) || ('' == mysql_error($link))) printf("[005] mysql_errno()/mysql_error should return some error\n"); if (!$res = mysql_unbuffered_query('SELECT "this is sql but with semicolon" AS valid ; ', $link)) printf("[006] [%d] %s\n", mysql_errno($link), mysql_error($link)); var_dump(mysql_fetch_assoc($res)); mysql_free_result($res); if (false !== ($res = mysql_unbuffered_query('SELECT "this is sql but with semicolon" AS valid ; SHOW VARIABLES', $link))) printf("[007] [%d] %s\n", mysql_errno($link), mysql_error($link)); if (mysql_unbuffered_query('DROP PROCEDURE IF EXISTS p', $link)) { // let's try to play with stored procedures if (mysql_unbuffered_query('CREATE PROCEDURE p(OUT ver_param VARCHAR(25)) BEGIN SELECT VERSION() INTO ver_param; END;', $link)) { $res = mysql_unbuffered_query('CALL p(@version)', $link); $res = mysql_unbuffered_query('SELECT @version AS p_version', $link); var_dump(mysql_fetch_assoc($res)); mysql_free_result($res); } else { printf("[008] [%d] %s\n", mysql_errno($link), mysql_error($link)); } mysql_unbuffered_query('DROP FUNCTION IF EXISTS f', $link); if (mysql_unbuffered_query('CREATE FUNCTION f( ver_param VARCHAR(25)) RETURNS VARCHAR(25) DETERMINISTIC RETURN ver_param;', $link)) { $res = mysql_unbuffered_query('SELECT f(VERSION()) AS f_version', $link); var_dump(mysql_fetch_assoc($res)); mysql_free_result($res); } else { printf("[009] [%d] %s\n", mysql_errno($link), mysql_error($link)); } } var_dump(mysql_unbuffered_query('INSERT INTO test(id) VALUES (100)', $link)); var_dump($res = mysql_unbuffered_query('SELECT id FROM test', $link)); var_dump(mysql_num_rows($res)); mysql_close($link); if (false !== ($tmp = mysql_unbuffered_query("SELECT id FROM test", $link))) printf("[010] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp); print "done!"; ?> --EXPECTF-- array(1) { ["valid"]=> string(30) "this is sql but with semicolon" } array(1) { ["p_version"]=> string(16) "5.0.26-debug-log" } array(1) { ["f_version"]=> string(16) "5.0.26-debug-log" } bool(true) resource(%d) of type (mysql result) int(0) Notice: mysql_close(): Function called without first fetching all rows from a previous unbuffered query in %s on line %d Warning: mysql_unbuffered_query(): %d is not a valid MySQL-Link resource in %s on line %d done! --UEXPECTF-- array(1) { [u"valid"]=> unicode(30) "this is sql but with semicolon" } array(1) { [u"p_version"]=> unicode(16) "5.0.26-debug-log" } array(1) { [u"f_version"]=> unicode(16) "5.0.26-debug-log" } bool(true) resource(%d) of type (mysql result) int(0) Notice: mysql_close(): Function called without first fetching all rows from a previous unbuffered query in %s on line %d Warning: mysql_unbuffered_query(): %d is not a valid MySQL-Link resource in %s on line %d done!
« previous php.cvs (#46591) next »