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())) if (false !== ($tmp = @mysql_affected_rows()))
printf("[001] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp); printf("[001] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
if (false !== ($tmp = @mysql_affected_rows($link))) if (null !== ($tmp = @mysql_affected_rows($link)))
printf("[002] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp); printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
if (!is_null($tmp = @mysql_affected_rows($link, $link))) if (!is_null($tmp = @mysql_affected_rows($link, $link)))
printf("[003] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); 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); $host, $user, $db, $port, $socket);
$tmp = @mysql_close(NULL); $tmp = @mysql_close(NULL);
if (false !== $tmp) if (null !== $tmp)
printf("[004] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp); printf("[004] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
$tmp = mysql_close($link); $tmp = mysql_close($link);
if (true !== $tmp) if (true !== $tmp)

View file

@ -18,8 +18,8 @@ if (NULL !== ($tmp = @mysql_data_seek()))
if (NULL !== ($tmp = @mysql_data_seek($link))) if (NULL !== ($tmp = @mysql_data_seek($link)))
printf("[002] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp); printf("[002] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
if (false !== ($tmp = @mysql_data_seek($link, $link))) if (NULL !== ($tmp = @mysql_data_seek($link, $link)))
printf("[003] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp); printf("[003] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
require('table.inc'); require('table.inc');
if (!$res = mysql_query('SELECT * FROM test ORDER BY id LIMIT 4', $link)) if (!$res = mysql_query('SELECT * FROM test ORDER BY id LIMIT 4', $link))

View file

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

View file

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

View file

@ -15,8 +15,8 @@ $link = NULL;
if (false !== ($tmp = @mysql_error())) if (false !== ($tmp = @mysql_error()))
printf("[001] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp); printf("[001] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
if (false !== ($tmp = @mysql_error($link))) if (NULL !== ($tmp = @mysql_error($link)))
printf("[002] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp); printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
if (!is_null($tmp = @mysql_error($link, 'too many args'))) if (!is_null($tmp = @mysql_error($link, 'too many args')))
printf("[002b] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); printf("[002b] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);

View file

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

View file

@ -15,8 +15,8 @@ $link = NULL;
if (!is_null($tmp = @mysql_fetch_lengths())) if (!is_null($tmp = @mysql_fetch_lengths()))
printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
if (false !== ($tmp = @mysql_fetch_lengths($link))) if (NULL !== ($tmp = @mysql_fetch_lengths($link)))
printf("[002] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp); printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
require('table.inc'); require('table.inc');
if (!$res = mysql_query("SELECT id, label FROM test ORDER BY id LIMIT 1", $link)) { if (!$res = mysql_query("SELECT id, label FROM test ORDER BY id LIMIT 1", $link)) {

View file

@ -136,7 +136,7 @@ mysql_close($link);
print "done!"; print "done!";
?> ?>
--EXPECTF-- --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 Warning: mysql_field_flags(): Field -1 is invalid for MySQL result index %d in %s on line %d

View file

@ -43,7 +43,7 @@ mysql_close($link);
print "done!"; print "done!";
?> ?>
--EXPECTF-- --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 Warning: mysql_field_len(): Field -1 is invalid for MySQL result index %d in %s on line %d

View file

@ -42,7 +42,7 @@ mysql_close($link);
print "done!"; print "done!";
?> ?>
--EXPECTF-- --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 Warning: mysql_field_name(): Field -1 is invalid for MySQL result index %d in %s on line %d
string(2) "id" string(2) "id"

View file

@ -42,7 +42,7 @@ mysql_close($link);
print "done!"; print "done!";
?> ?>
--EXPECTF-- --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 Warning: mysql_field_table(): Field -1 is invalid for MySQL result index %d in %s on line %d
string(4) "test" string(4) "test"

View file

@ -42,7 +42,7 @@ mysql_close($link);
print "done!"; print "done!";
?> ?>
--EXPECTF-- --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 Warning: mysql_field_type(): Field -1 is invalid for MySQL result index %d in %s on line %d
string(3) "int" string(3) "int"

View file

@ -15,8 +15,8 @@ $link = NULL;
if (!is_null($tmp = @mysql_free_result())) if (!is_null($tmp = @mysql_free_result()))
printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
if (false !== ($tmp = @mysql_free_result($link))) if (null !== ($tmp = @mysql_free_result($link)))
printf("[002] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp); printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
require('table.inc'); require('table.inc');
if (!$res = mysql_query("SELECT id FROM test ORDER BY id LIMIT 1", $link)) { if (!$res = mysql_query("SELECT id FROM test ORDER BY id LIMIT 1", $link)) {

View file

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

View file

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

View file

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

View file

@ -15,8 +15,8 @@ $link = NULL;
if (false !== ($tmp = @mysql_insert_id())) if (false !== ($tmp = @mysql_insert_id()))
printf("[001] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp); printf("[001] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
if (false !== ($tmp = @mysql_insert_id($link))) if (NULL !== ($tmp = @mysql_insert_id($link)))
printf("[002] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp); printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
if (!is_null($tmp = @mysql_insert_id($link, 'too many args'))) if (!is_null($tmp = @mysql_insert_id($link, 'too many args')))
printf("[002a] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); printf("[002a] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);

View file

@ -12,8 +12,8 @@ include_once "connect.inc";
$tmp = NULL; $tmp = NULL;
$link = NULL; $link = NULL;
if (false !== ($tmp = @mysql_list_dbs(NULL))) if (NULL !== ($tmp = @mysql_list_dbs(NULL)))
printf("[001] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp); printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
if (NULL !== ($tmp = @mysql_list_dbs($link, $link))) if (NULL !== ($tmp = @mysql_list_dbs($link, $link)))
printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); 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))) if (false !== ($tmp = @mysql_list_tables(NULL)))
printf("[003] Expecting boolean/false got %s/%s\n", gettype($tmp), $tmp); printf("[003] Expecting boolean/false got %s/%s\n", gettype($tmp), $tmp);
if (false !== ($tmp = @mysql_list_tables($db, NULL))) if (NULL !== ($tmp = @mysql_list_tables($db, NULL)))
printf("[004] Expecting boolean/false got %s/%s\n", gettype($tmp), $tmp); printf("[004] Expecting NULL got %s/%s\n", gettype($tmp), $tmp);
require_once('table.inc'); require_once('table.inc');

View file

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

View file

@ -15,8 +15,8 @@ $link = NULL;
if (!is_null($tmp = @mysql_num_rows())) if (!is_null($tmp = @mysql_num_rows()))
printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
if (false !== ($tmp = @mysql_num_rows($link))) if (NULL !== ($tmp = @mysql_num_rows($link)))
printf("[002] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp); printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
require('table.inc'); 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, "SELECT 1 AS a", 1, 5);
func_test_mysql_num_rows($link, "SHOW VARIABLES LIKE '%nixnutz%'", 0, 10); 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); 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)) { if ($res = mysql_query('SELECT COUNT(id) AS num FROM test', $link)) {
@ -58,9 +58,9 @@ mysql_close($link);
print "done!"; print "done!";
?> ?>
--EXPECTF-- --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 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!"; print "done!";
?> ?>
--EXPECTF-- --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 Warning: mysql_tablename(): Unable to jump to row -1 on MySQL result index %d in %s on line %d
string(1) "1" string(1) "1"