MFH: New param parsing for ext/mysql

This commit is contained in:
Johannes Schlüter 2008-11-28 20:23:49 +00:00
parent e651a09ddf
commit cfc3bfdabb
24 changed files with 355 additions and 520 deletions

File diff suppressed because it is too large Load diff

View file

@ -15,8 +15,8 @@ $link = NULL;
if (false !== ($tmp = @mysql_affected_rows()))
printf("[001] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
if (false !== ($tmp = @mysql_affected_rows($link)))
printf("[002] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
if (null !== ($tmp = @mysql_affected_rows($link)))
printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
if (!is_null($tmp = @mysql_affected_rows($link, $link)))
printf("[003] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);

View file

@ -23,8 +23,8 @@ if (!$link = my_mysql_connect($host, $user, $passwd, $db, $port, $socket))
$host, $user, $db, $port, $socket);
$tmp = @mysql_close(NULL);
if (false !== $tmp)
printf("[004] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
if (null !== $tmp)
printf("[004] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
$tmp = mysql_close($link);
if (true !== $tmp)
@ -36,4 +36,4 @@ if (false !== ($tmp = @mysql_query("SELECT 1", $link)))
print "done!\n";
?>
--EXPECTF--
done!
done!

View file

@ -18,8 +18,8 @@ if (NULL !== ($tmp = @mysql_data_seek()))
if (NULL !== ($tmp = @mysql_data_seek($link)))
printf("[002] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
if (false !== ($tmp = @mysql_data_seek($link, $link)))
printf("[003] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
if (NULL !== ($tmp = @mysql_data_seek($link, $link)))
printf("[003] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
require('table.inc');
if (!$res = mysql_query('SELECT * FROM test ORDER BY id LIMIT 4', $link))
@ -70,4 +70,4 @@ Warning: mysql_data_seek(): Offset -1 is invalid for MySQL result index %d (or t
Warning: mysql_data_seek(): Offset 3 is invalid for MySQL result index %d (or the query data is unbuffered) in %s on line %d
Warning: mysql_data_seek(): %d is not a valid MySQL result resource in %s on line %d
done!
done!

View file

@ -15,8 +15,8 @@ $link = NULL;
if (NULL !== ($tmp = @mysql_db_name()))
printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
if (false !== ($tmp = @mysql_db_name($link, $link)))
printf("[002] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
if (NULL !== ($tmp = @mysql_db_name($link, $link)))
printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
require('table.inc');
@ -63,4 +63,4 @@ Warning: mysql_db_name(): Unable to jump to row -1 on MySQL result index %d in %
Warning: mysql_db_name(): Unable to jump to row %d on MySQL result index %d in %s on line %d
Warning: mysql_db_name(): %d is not a valid MySQL result resource in %s on line %d
done!
done!

View file

@ -15,8 +15,8 @@ $link = NULL;
if (false !== ($tmp = @mysql_errno()))
printf("[001] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
if (false !== ($tmp = @mysql_errno($link)))
printf("[002] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
if (null !== ($tmp = @mysql_errno($link)))
printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
if (!is_null($tmp = @mysql_errno($link, 'too many args')))
printf("[002b] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
@ -56,4 +56,4 @@ int(%d)
Warning: mysql_errno(): %d is not a valid MySQL-Link resource in %s on line %d
bool(false)
done!
done!

View file

@ -15,8 +15,8 @@ $link = NULL;
if (false !== ($tmp = @mysql_error()))
printf("[001] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
if (false !== ($tmp = @mysql_error($link)))
printf("[002] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
if (NULL !== ($tmp = @mysql_error($link)))
printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
if (!is_null($tmp = @mysql_error($link, 'too many args')))
printf("[002b] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
@ -60,4 +60,4 @@ print "done!";
--EXPECTF--
Warning: mysql_error(): %d is not a valid MySQL-Link resource in %s on line %d
bool(false)
done!
done!

View file

@ -16,8 +16,8 @@ require_once('skipifconnectfailure.inc');
if (!is_null($tmp = @mysql_fetch_field()))
printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
if (false !== ($tmp = @mysql_fetch_field($link)))
printf("[002] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
if (NULL !== ($tmp = @mysql_fetch_field($link)))
printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
require('table.inc');

View file

@ -15,8 +15,8 @@ $link = NULL;
if (!is_null($tmp = @mysql_fetch_lengths()))
printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
if (false !== ($tmp = @mysql_fetch_lengths($link)))
printf("[002] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
if (NULL !== ($tmp = @mysql_fetch_lengths($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)) {
@ -45,4 +45,4 @@ bool(false)
Warning: mysql_fetch_lengths(): %d is not a valid MySQL result resource in %s on line %d
bool(false)
done!
done!

View file

@ -136,7 +136,7 @@ mysql_close($link);
print "done!";
?>
--EXPECTF--
Warning: Wrong parameter count for mysql_field_flags() in %s on line %d
Warning: mysql_field_flags() expects exactly 2 parameters, 1 given in %s on line %d
Warning: mysql_field_flags(): Field -1 is invalid for MySQL result index %d in %s on line %d
@ -144,4 +144,4 @@ Warning: mysql_field_flags(): Field 2 is invalid for MySQL result index %d in %s
Warning: mysql_field_flags(): %d is not a valid MySQL result resource in %s on line %d
bool(false)
done!
done!

View file

@ -43,7 +43,7 @@ mysql_close($link);
print "done!";
?>
--EXPECTF--
Warning: Wrong parameter count for mysql_field_len() in %s on line %d
Warning: mysql_field_len() expects exactly 2 parameters, 1 given in %s on line %d
Warning: mysql_field_len(): Field -1 is invalid for MySQL result index %d in %s on line %d
@ -51,4 +51,4 @@ Warning: mysql_field_len(): Field 2 is invalid for MySQL result index %d in %s o
Warning: mysql_field_len(): %d is not a valid MySQL result resource in %s on line %d
bool(false)
done!
done!

View file

@ -42,7 +42,7 @@ mysql_close($link);
print "done!";
?>
--EXPECTF--
Warning: Wrong parameter count for mysql_field_name() in %s on line %d
Warning: mysql_field_name() expects exactly 2 parameters, 1 given in %s on line %d
Warning: mysql_field_name(): Field -1 is invalid for MySQL result index %d in %s on line %d
string(2) "id"
@ -62,4 +62,4 @@ Warning: mysql_field_name(): Field 2 is invalid for MySQL result index %d in %s
Warning: mysql_field_name(): %d is not a valid MySQL result resource in %s on line %d
bool(false)
done!
done!

View file

@ -42,7 +42,7 @@ mysql_close($link);
print "done!";
?>
--EXPECTF--
Warning: Wrong parameter count for mysql_field_table() in %s on line %d
Warning: mysql_field_table() expects exactly 2 parameters, 1 given in %s on line %d
Warning: mysql_field_table(): Field -1 is invalid for MySQL result index %d in %s on line %d
string(4) "test"
@ -62,4 +62,4 @@ Warning: mysql_field_table(): Field 2 is invalid for MySQL result index %d in %s
Warning: mysql_field_table(): %d is not a valid MySQL result resource in %s on line %d
bool(false)
done!
done!

View file

@ -42,7 +42,7 @@ mysql_close($link);
print "done!";
?>
--EXPECTF--
Warning: Wrong parameter count for mysql_field_type() in %s on line %d
Warning: mysql_field_type() expects exactly 2 parameters, 1 given in %s on line %d
Warning: mysql_field_type(): Field -1 is invalid for MySQL result index %d in %s on line %d
string(3) "int"
@ -62,4 +62,4 @@ Warning: mysql_field_type(): Field 2 is invalid for MySQL result index %d in %s
Warning: mysql_field_type(): %d is not a valid MySQL result resource in %s on line %d
bool(false)
done!
done!

View file

@ -15,8 +15,8 @@ $link = NULL;
if (!is_null($tmp = @mysql_free_result()))
printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
if (false !== ($tmp = @mysql_free_result($link)))
printf("[002] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
if (null !== ($tmp = @mysql_free_result($link)))
printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
require('table.inc');
if (!$res = mysql_query("SELECT id FROM test ORDER BY id LIMIT 1", $link)) {
@ -44,4 +44,4 @@ bool(true)
Warning: mysql_free_result(): %d is not a valid MySQL result resource in %s on line %d
bool(false)
done!
done!

View file

@ -9,8 +9,8 @@ require_once('skipifconnectfailure.inc');
<?php
include_once "connect.inc";
if (false !== ($tmp = @mysql_get_host_info(NULL)))
printf("[001] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
if (NULL !== ($tmp = @mysql_get_host_info(NULL)))
printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
require "table.inc";
if (!is_string($info = mysql_get_host_info($link)) || ('' === $info))
@ -37,4 +37,4 @@ if (!is_null($tmp = @mysql_get_host_info($link, "too many arguments"))) {
print "done!";
?>
--EXPECTF--
done!
done!

View file

@ -9,8 +9,8 @@ require_once('skipifconnectfailure.inc');
<?php
include_once "connect.inc";
if (false !== ($tmp = @mysql_get_proto_info(NULL)))
printf("[002] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
if (NULL !== ($tmp = @mysql_get_proto_info(NULL)))
printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
require "table.inc";
if (!is_int($info = mysql_get_proto_info($link)) || (0 === $info))

View file

@ -9,8 +9,8 @@ require_once('skipifconnectfailure.inc');
<?php
include "connect.inc";
if (false !== ($tmp = @mysql_get_server_info(NULL)))
printf("[002] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
if (null !== ($tmp = @mysql_get_server_info(NULL)))
printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
require "table.inc";
if (!is_string($info = mysql_get_server_info($link)) || ('' === $info))

View file

@ -15,8 +15,8 @@ $link = NULL;
if (false !== ($tmp = @mysql_insert_id()))
printf("[001] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
if (false !== ($tmp = @mysql_insert_id($link)))
printf("[002] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
if (NULL !== ($tmp = @mysql_insert_id($link)))
printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
if (!is_null($tmp = @mysql_insert_id($link, 'too many args')))
printf("[002a] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
@ -63,4 +63,4 @@ print "done!";
--EXPECTF--
Warning: mysql_insert_id(): %d is not a valid MySQL-Link resource in %s on line %d
bool(false)
done!
done!

View file

@ -12,8 +12,8 @@ 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(NULL)))
printf("[001] Expecting NULL, 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);

View file

@ -21,8 +21,8 @@ if (NULL !== ($tmp = @mysql_list_tables('too', 'many', 'arguments')))
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);
if (NULL !== ($tmp = @mysql_list_tables($db, NULL)))
printf("[004] Expecting NULL got %s/%s\n", gettype($tmp), $tmp);
require_once('table.inc');
@ -78,4 +78,4 @@ mysql_close($link);
print "done!\n";
?>
--EXPECTF--
done!
done!

View file

@ -15,8 +15,8 @@ $link = NULL;
if (!is_null($tmp = @mysql_num_fields()))
printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
if (false !== ($tmp = @mysql_num_fields($link)))
printf("[002] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
if (NULL !== ($tmp = @mysql_num_fields($link)))
printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
require('table.inc');
@ -49,4 +49,4 @@ print "done!";
?>
--EXPECTF--
Warning: mysql_num_fields(): %d is not a valid MySQL result resource in %s on line %d
done!
done!

View file

@ -15,8 +15,8 @@ $link = NULL;
if (!is_null($tmp = @mysql_num_rows()))
printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
if (false !== ($tmp = @mysql_num_rows($link)))
printf("[002] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
if (NULL !== ($tmp = @mysql_num_rows($link)))
printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
require('table.inc');
@ -40,7 +40,7 @@ function func_test_mysql_num_rows($link, $query, $expected, $offset, $test_free
func_test_mysql_num_rows($link, "SELECT 1 AS a", 1, 5);
func_test_mysql_num_rows($link, "SHOW VARIABLES LIKE '%nixnutz%'", 0, 10);
func_test_mysql_num_rows($link, "INSERT INTO test(id, label) VALUES (100, 'z')", false, 15);
func_test_mysql_num_rows($link, "INSERT INTO test(id, label) VALUES (100, 'z')", NULL, 15);
func_test_mysql_num_rows($link, "SELECT id FROM test LIMIT 2", 2, 20, true);
if ($res = mysql_query('SELECT COUNT(id) AS num FROM test', $link)) {
@ -58,9 +58,9 @@ mysql_close($link);
print "done!";
?>
--EXPECTF--
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in %s on line %d
Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in %s on line %d
Warning: mysql_free_result(): supplied argument is not a valid MySQL result resource in %s on line %d
Warning: mysql_free_result() expects parameter 1 to be resource, boolean given in %s on line %d
Warning: mysql_num_rows(): %d is not a valid MySQL result resource in %s on line %d
done!
done!

View file

@ -42,7 +42,7 @@ mysql_close($link);
print "done!";
?>
--EXPECTF--
Warning: Wrong parameter count for mysql_tablename() in %s on line %d
Warning: mysql_tablename() expects at least 2 parameters, 1 given 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"
@ -62,4 +62,4 @@ Warning: mysql_tablename(): Unable to jump to row 2 on MySQL result index %d in
Warning: mysql_tablename(): %d is not a valid MySQL result resource in %s on line %d
bool(false)
done!
done!