uw Wed Oct 10 10:56:33 2007 UTC Modified files: /php-src/ext/mysql/tests mysql_fetch_assoc.phpt mysql_fetch_field.phpt mysql_fetch_object.phpt mysql_list_fields.phpt mysql_result.phpt Log: Test changes for HEAD = synching with 5_3
http://cvs.php.net/viewvc.cgi/php-src/ext/mysql/tests/mysql_fetch_assoc.phpt?r1=1.3&r2=1.4&diff_format=u Index: php-src/ext/mysql/tests/mysql_fetch_assoc.phpt diff -u php-src/ext/mysql/tests/mysql_fetch_assoc.phpt:1.3 php-src/ext/mysql/tests/mysql_fetch_assoc.phpt:1.4 --- php-src/ext/mysql/tests/mysql_fetch_assoc.phpt:1.3 Thu Aug 9 11:53:17 2007 +++ php-src/ext/mysql/tests/mysql_fetch_assoc.phpt Wed Oct 10 10:56:33 2007 @@ -1,8 +1,8 @@ --TEST-- mysql_fetch_assoc() --SKIPIF-- -<?php -require_once('skipif.inc'); +<?php +require_once('skipif.inc'); require_once('skipifconnectfailure.inc'); ?> --FILE-- @@ -46,6 +46,16 @@ mysql_close($link); +include('table.inc'); +if (!$res = mysql_query("SELECT id, label, id AS _id, CONCAT(label, 'a') _label, NULL as _foo FROM test _test ORDER BY id ASC LIMIT 1", $link)) { + printf("[009] [%d] %s\n", mysql_errno($link), $mysql_error($link)); +} +print "[010]\n"; +var_dump(mysql_fetch_assoc($res)); +mysql_free_result($res); + +mysql_close($link); + print "done!"; ?> --EXPECTF-- @@ -73,6 +83,19 @@ } Warning: mysql_fetch_assoc(): %d is not a valid MySQL result resource in %s on line %d +[010] +array(5) { + ["id"]=> + string(1) "1" + ["label"]=> + string(1) "a" + ["_id"]=> + string(1) "1" + ["_label"]=> + string(2) "aa" + ["_foo"]=> + NULL +} done! --UEXPECTF-- [005] @@ -99,4 +122,17 @@ } Warning: mysql_fetch_assoc(): %d is not a valid MySQL result resource in %s on line %d +[010] +array(5) { + [u"id"]=> + unicode(1) "1" + [u"label"]=> + unicode(1) "a" + [u"_id"]=> + unicode(1) "1" + [u"_label"]=> + unicode(2) "aa" + [u"_foo"]=> + NULL +} done! \ No newline at end of file http://cvs.php.net/viewvc.cgi/php-src/ext/mysql/tests/mysql_fetch_field.phpt?r1=1.4&r2=1.5&diff_format=u Index: php-src/ext/mysql/tests/mysql_fetch_field.phpt diff -u php-src/ext/mysql/tests/mysql_fetch_field.phpt:1.4 php-src/ext/mysql/tests/mysql_fetch_field.phpt:1.5 --- php-src/ext/mysql/tests/mysql_fetch_field.phpt:1.4 Thu Aug 9 11:53:17 2007 +++ php-src/ext/mysql/tests/mysql_fetch_field.phpt Wed Oct 10 10:56:33 2007 @@ -1,8 +1,8 @@ --TEST-- mysql_fetch_field() --SKIPIF-- -<?php -require_once('skipif.inc'); +<?php +require_once('skipif.inc'); require_once('skipifconnectfailure.inc'); ?> --FILE-- @@ -21,7 +21,6 @@ require('table.inc'); - $version = mysql_get_server_info($link); if (!preg_match('@(\d+)\.(\d+)\.(\d+)@ism', $version, $matches)) printf("[003] Cannot get server version\n"); @@ -105,6 +104,32 @@ mysql_free_result($res); } + if (!mysql_query("DROP TABLE IF EXISTS test", $link)) + printf("[013] [%d] %s\n", mysql_errno($link), mysql_error($link)); + + if (!mysql_query("CREATE TABLE test(id INT DEFAULT 1)")) + printf("[014] [%d] %s\n", mysql_errno($link), mysql_error($link)); + + if (!mysql_query("INSERT INTO test(id) VALUES (2)")) + printf("[015] [%d] %s\n", mysql_errno($link), mysql_error($link)); + + if (!$res = mysql_query("SELECT id FROM test", $link)) { + printf("[016] [%d] %s\n", mysql_errno($link), mysql_error($link)); + } + + var_dump(mysql_fetch_field($res)); + mysql_free_result($res); + + if (!$res = mysql_query("SELECT id FROM test", $link)) { + printf("[017] [%d] %s\n", mysql_errno($link), mysql_error($link)); + } + $res = mysql_list_fields($db, 'test'); + while ($tmp = mysql_fetch_field($res)) + if ($tmp->name == 'id') + var_dump($tmp); + + mysql_free_result($res); + mysql_close($link); print "done!"; ?> @@ -170,6 +195,62 @@ Warning: mysql_fetch_field(): Bad field offset in %s on line %d Warning: mysql_fetch_field(): %d is not a valid MySQL result resource in %s on line %d +object(stdClass)#%d (13) { + ["name"]=> + string(2) "id" + ["table"]=> + string(4) "test" + ["def"]=> + string(0) "" + ["max_length"]=> + int(1) + ["not_null"]=> + int(0) + ["primary_key"]=> + int(0) + ["multiple_key"]=> + int(0) + ["unique_key"]=> + int(0) + ["numeric"]=> + int(1) + ["blob"]=> + int(0) + ["type"]=> + string(3) "int" + ["unsigned"]=> + int(0) + ["zerofill"]=> + int(0) +} +object(stdClass)#%d (13) { + ["name"]=> + string(2) "id" + ["table"]=> + string(4) "test" + ["def"]=> + string(1) "1" + ["max_length"]=> + int(0) + ["not_null"]=> + int(0) + ["primary_key"]=> + int(0) + ["multiple_key"]=> + int(0) + ["unique_key"]=> + int(0) + ["numeric"]=> + int(1) + ["blob"]=> + int(0) + ["type"]=> + string(3) "int" + ["unsigned"]=> + int(0) + ["zerofill"]=> + int(0) +} done! --UEXPECTF-- object(stdClass)#%d (13) { @@ -233,4 +314,60 @@ Warning: mysql_fetch_field(): Bad field offset in %s on line %d Warning: mysql_fetch_field(): %d is not a valid MySQL result resource in %s on line %d +object(stdClass)#%d (13) { + [u"name"]=> + unicode(2) "id" + [u"table"]=> + unicode(4) "test" + [u"def"]=> + unicode(0) "" + [u"max_length"]=> + int(1) + [u"not_null"]=> + int(0) + [u"primary_key"]=> + int(0) + [u"multiple_key"]=> + int(0) + [u"unique_key"]=> + int(0) + [u"numeric"]=> + int(1) + [u"blob"]=> + int(0) + [u"type"]=> + unicode(3) "int" + [u"unsigned"]=> + int(0) + [u"zerofill"]=> + int(0) +} +object(stdClass)#%d (13) { + [u"name"]=> + unicode(2) "id" + [u"table"]=> + unicode(4) "test" + [u"def"]=> + unicode(1) "1" + [u"max_length"]=> + int(0) + [u"not_null"]=> + int(0) + [u"primary_key"]=> + int(0) + [u"multiple_key"]=> + int(0) + [u"unique_key"]=> + int(0) + [u"numeric"]=> + int(1) + [u"blob"]=> + int(0) + [u"type"]=> + unicode(3) "int" + [u"unsigned"]=> + int(0) + [u"zerofill"]=> + int(0) +} done! http://cvs.php.net/viewvc.cgi/php-src/ext/mysql/tests/mysql_fetch_object.phpt?r1=1.3&r2=1.4&diff_format=u Index: php-src/ext/mysql/tests/mysql_fetch_object.phpt diff -u php-src/ext/mysql/tests/mysql_fetch_object.phpt:1.3 php-src/ext/mysql/tests/mysql_fetch_object.phpt:1.4 --- php-src/ext/mysql/tests/mysql_fetch_object.phpt:1.3 Thu Aug 9 11:53:17 2007 +++ php-src/ext/mysql/tests/mysql_fetch_object.phpt Wed Oct 10 10:56:33 2007 @@ -1,8 +1,8 @@ --TEST-- mysql_fetch_object() --SKIPIF-- -<?php -require_once('skipif.inc'); +<?php +require_once('skipif.inc'); require_once('skipifconnectfailure.inc'); ?> --FILE-- @@ -50,7 +50,16 @@ var_dump(mysql_fetch_object($res, 'mysql_fetch_object_construct', array('a'))); var_dump(mysql_fetch_object($res, 'mysql_fetch_object_construct', array('a', 'b'))); var_dump(mysql_fetch_object($res, 'mysql_fetch_object_construct', array('a', 'b', 'c'))); +var_dump(mysql_fetch_object($res, 'mysql_fetch_object_construct', "no array and not null")); var_dump(mysql_fetch_object($res)); +var_dump(mysql_fetch_object($res, 'mysql_fetch_object_construct', array('a', 'b'))); + +class mysql_fetch_object_private_construct { + private function __construct($a, $b) { + var_dump($a); + } +} +var_dump(mysql_fetch_object($res, 'mysql_fetch_object_private_construct', array('a', 'b'))); mysql_free_result($res); @@ -129,6 +138,9 @@ } bool(false) bool(false) +bool(false) +bool(false) +bool(false) Warning: mysql_fetch_object(): %d is not a valid MySQL result resource in %s on line %d bool(false) @@ -195,6 +207,9 @@ } bool(false) bool(false) +bool(false) +bool(false) +bool(false) Warning: mysql_fetch_object(): %d is not a valid MySQL result resource in %s on line %d bool(false) http://cvs.php.net/viewvc.cgi/php-src/ext/mysql/tests/mysql_list_fields.phpt?r1=1.3&r2=1.4&diff_format=u Index: php-src/ext/mysql/tests/mysql_list_fields.phpt diff -u php-src/ext/mysql/tests/mysql_list_fields.phpt:1.3 php-src/ext/mysql/tests/mysql_list_fields.phpt:1.4 --- php-src/ext/mysql/tests/mysql_list_fields.phpt:1.3 Thu Aug 9 11:53:17 2007 +++ php-src/ext/mysql/tests/mysql_list_fields.phpt Wed Oct 10 10:56:33 2007 @@ -12,10 +12,12 @@ $tmp = NULL; $link = NULL; -if (false !== ($tmp = @mysql_list_fields($link, $link))) - printf("[002] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp); +// This will implicitly try to connect, and we don't want it +//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)); @@ -28,4 +30,4 @@ print "done!"; ?> --EXPECTF-- -done! \ No newline at end of file +done! http://cvs.php.net/viewvc.cgi/php-src/ext/mysql/tests/mysql_result.phpt?r1=1.3&r2=1.4&diff_format=u Index: php-src/ext/mysql/tests/mysql_result.phpt diff -u php-src/ext/mysql/tests/mysql_result.phpt:1.3 php-src/ext/mysql/tests/mysql_result.phpt:1.4 --- php-src/ext/mysql/tests/mysql_result.phpt:1.3 Thu Aug 9 11:53:17 2007 +++ php-src/ext/mysql/tests/mysql_result.phpt Wed Oct 10 10:56:33 2007 @@ -1,13 +1,13 @@ --TEST-- mysql_result() --SKIPIF-- -<?php -require_once('skipif.inc'); +<?php +require_once('skipif.inc'); require_once('skipifconnectfailure.inc'); ?> --FILE-- <?php -include "connect.inc"; +require_once("connect.inc"); $tmp = NULL; $link = NULL; @@ -20,8 +20,8 @@ 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, id AS _id, CONCAT(label, 'a') _label, NULL as _foo FROM test _test ORDER BY id LIMIT 1", $link)) { +require_once('table.inc'); +if (!$res = mysql_query("SELECT id, label, id AS _id, CONCAT(label, 'a') _label, NULL as _foo FROM test _test ORDER BY id ASC LIMIT 1", $link)) { printf("[003] [%d] %s\n", mysql_errno($link), mysql_error($link)); } @@ -50,6 +50,8 @@ var_dump(mysql_result($res, 0, '_label')); print "_foo\n"; var_dump(mysql_result($res, 0, '_foo')); +var_dump(mysql_result($res, 0, 'test.id')); +var_dump(mysql_result($res, 0, 'test.label')); mysql_free_result($res); @@ -97,6 +99,12 @@ _foo NULL +Warning: mysql_result(): test.id not found in MySQL result index %d in %s on line %d +bool(false) + +Warning: mysql_result(): test.label not found in MySQL result index %d in %s on line %d +bool(false) + Warning: mysql_result(): %d is not a valid MySQL result resource in %s on line %d bool(false) done! @@ -135,10 +143,16 @@ _id unicode(1) "1" _label -unicode(2) "aa" +string(2) "aa" _foo NULL +Warning: mysql_result(): test.id not found in MySQL result index %d in %s on line %d +bool(false) + +Warning: mysql_result(): test.label not found in MySQL result index %d in %s on line %d +bool(false) + Warning: mysql_result(): %d is not a valid MySQL result resource in %s on line %d bool(false) done! \ No newline at end of file
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php