cvs: php-src(PHP_5_3) /ext/mysql/tests mysql_list_fields.phpt
| From: | Ulf Wendel | Date: | Thu, 02 Jul 2009 07:42:49 +0000 |
| Subject: | cvs: php-src(PHP_5_3) /ext/mysql/tests mysql_list_fields.phpt | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-59161@lists.php.net to get a copy of this message | ||
uw Thu Jul 2 07:42:49 2009 UTC
Modified files: (Branch: PHP_5_3)
/php-src/ext/mysql/tests mysql_list_fields.phpt
Log:
MFH - Test for bug #48754
http://cvs.php.net/viewvc.cgi/php-src/ext/mysql/tests/mysql_list_fields.phpt?r1=1.3.2.2&r2=1.3.2.3&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.2.2
php-src/ext/mysql/tests/mysql_list_fields.phpt:1.3.2.3
--- php-src/ext/mysql/tests/mysql_list_fields.phpt:1.3.2.2 Wed Oct 10 09:56:47 2007
+++ php-src/ext/mysql/tests/mysql_list_fields.phpt Thu Jul 2 07:42:48 2009
@@ -1,8 +1,8 @@
--TEST--
mysql_list_fields()
--SKIPIF--
-<?php
-require_once('skipif.inc');
+<?php
+require_once('skipif.inc');
require_once('skipifconnectfailure.inc');
?>
--FILE--
@@ -21,8 +21,20 @@
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));
+if (2 !== ($num = mysql_num_fields($res)))
+ printf("[004] Expecting two fields, got %d. [%d] %s\n", $num, mysql_errno($link),
mysql_error($link));
+
+mysql_free_result($res);
+
+if (!mysql_query("DROP TABLE IF EXISTS test2", $link) ||
+ !mysql_query("CREATE TABLE test2(id INT)", $link))
+ printf("[005] [%d] %s\n", mysql_errno($link), mysql_error($link));
+
+if (!$res = mysql_list_fields($db, 'test%', $link))
+ printf("[006] [%d] %s\n", mysql_errno($link), mysql_error($link));
+
+if (3 !== ($num = mysql_num_fields($res)))
+ printf("[007] Expecting 3 fields from test and test2, got %d. [%d] %s\n", $num,
mysql_errno($link), mysql_error($link));
mysql_free_result($res);
mysql_close($link);