uw                                       Fri, 02 Sep 2011 13:35:17 +0000

Revision: http://svn.php.net/viewvc?view=revision&revision=316038

Log:
Coverage for bug#54704, of which I think it is bogus, thus no dedicated test.

Bug: https://bugs.php.net/54704 (Feedback) mysql_num_rows() does work with 
mysql_unbuffered_query()
      
Changed paths:
    U   php/php-src/branches/PHP_5_3/ext/mysql/tests/mysql_num_rows.phpt
    U   php/php-src/branches/PHP_5_4/ext/mysql/tests/mysql_num_rows.phpt
    U   php/php-src/trunk/ext/mysql/tests/mysql_num_rows.phpt

Modified: php/php-src/branches/PHP_5_3/ext/mysql/tests/mysql_num_rows.phpt
===================================================================
--- php/php-src/branches/PHP_5_3/ext/mysql/tests/mysql_num_rows.phpt    
2011-09-02 13:24:05 UTC (rev 316037)
+++ php/php-src/branches/PHP_5_3/ext/mysql/tests/mysql_num_rows.phpt    
2011-09-02 13:35:17 UTC (rev 316038)
@@ -54,6 +54,23 @@
        printf("[030] [%d] %s\n", mysql_errno($link), mysql_error($link));
 }

+if ($res = mysql_unbuffered_query('SELECT id, label FROM test')) {
+
+       if (0 != mysql_num_rows($res))
+               printf("[032] Expecting 0 rows got %d\n", mysql_num_rows($res));
+
+       $rows = 0;
+       while ($row = mysql_fetch_assoc($res))
+               $rows++;
+
+       if ($rows != mysql_num_rows($res))
+               printf("[033] Expecting %d rows got %d\n", $rows, 
mysql_num_rows($res));
+
+       mysql_free_result($res);
+} else {
+       printf("[034] [%d] %s\n", mysql_errno($link), mysql_error($link));
+}
+
 mysql_close($link);
 print "done!";
 ?>

Modified: php/php-src/branches/PHP_5_4/ext/mysql/tests/mysql_num_rows.phpt
===================================================================
--- php/php-src/branches/PHP_5_4/ext/mysql/tests/mysql_num_rows.phpt    
2011-09-02 13:24:05 UTC (rev 316037)
+++ php/php-src/branches/PHP_5_4/ext/mysql/tests/mysql_num_rows.phpt    
2011-09-02 13:35:17 UTC (rev 316038)
@@ -54,6 +54,23 @@
        printf("[030] [%d] %s\n", mysql_errno($link), mysql_error($link));
 }

+if ($res = mysql_unbuffered_query('SELECT id, label FROM test')) {
+
+       if (0 != mysql_num_rows($res))
+               printf("[032] Expecting 0 rows got %d\n", mysql_num_rows($res));
+
+       $rows = 0;
+       while ($row = mysql_fetch_assoc($res))
+               $rows++;
+
+       if ($rows != mysql_num_rows($res))
+               printf("[033] Expecting %d rows got %d\n", $rows, 
mysql_num_rows($res));
+
+       mysql_free_result($res);
+} else {
+       printf("[034] [%d] %s\n", mysql_errno($link), mysql_error($link));
+}
+
 mysql_close($link);
 print "done!";
 ?>

Modified: php/php-src/trunk/ext/mysql/tests/mysql_num_rows.phpt
===================================================================
--- php/php-src/trunk/ext/mysql/tests/mysql_num_rows.phpt       2011-09-02 
13:24:05 UTC (rev 316037)
+++ php/php-src/trunk/ext/mysql/tests/mysql_num_rows.phpt       2011-09-02 
13:35:17 UTC (rev 316038)
@@ -54,6 +54,23 @@
        printf("[030] [%d] %s\n", mysql_errno($link), mysql_error($link));
 }

+if ($res = mysql_unbuffered_query('SELECT id, label FROM test')) {
+
+       if (0 != mysql_num_rows($res))
+               printf("[032] Expecting 0 rows got %d\n", mysql_num_rows($res));
+
+       $rows = 0;
+       while ($row = mysql_fetch_assoc($res))
+               $rows++;
+
+       if ($rows != mysql_num_rows($res))
+               printf("[033] Expecting %d rows got %d\n", $rows, 
mysql_num_rows($res));
+
+       mysql_free_result($res);
+} else {
+       printf("[034] [%d] %s\n", mysql_errno($link), mysql_error($link));
+}
+
 mysql_close($link);
 print "done!";
 ?>

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to