]> granicus.if.org Git - php/commitdiff
fixed a problem in mysqlnd. 0 was always as num_rows returned for
authorAndrey Hristov <andrey@php.net>
Wed, 16 Feb 2011 16:36:33 +0000 (16:36 +0000)
committerAndrey Hristov <andrey@php.net>
Wed, 16 Feb 2011 16:36:33 +0000 (16:36 +0000)
unbuffered sets (text protocol and PS).

NEWS
ext/mysqli/tests/mysqli_stmt_num_rows.phpt
ext/mysqlnd/mysqlnd_result.c

diff --git a/NEWS b/NEWS
index cef3f418f714365adede3ebfeee340815a2da266..49b929ec41cf913767dfb83eb45321dd7ffbc66c 100644 (file)
--- a/NEWS
+++ b/NEWS
   . Fixed bug #53963 (Ensure error_code is always set during some failed
     decodings). (Scott)
 
+- mysqlnd
+  . Fixed problem with always returning 0 as num_rows for unbuffered sets. 
+    (Andrey, Ulf)
+
 - MySQL Improved extension:
   . Added 'db' and 'catalog' keys to the field fetching functions (FR #39847). 
     (Kalle)
index 0a21bb54712c65283270e3850ab5497b3733d747..af81ca4e8ae6f23807d97789d0b14851e1a89877 100644 (file)
@@ -82,8 +82,8 @@ require_once('skipifconnectfailure.inc');
                        $i++;
                } while (mysqli_stmt_fetch($stmt));
 
-               if (0 !== ($tmp = mysqli_stmt_num_rows($stmt)))
-                       printf("[54] Expecting int/0, got %s/%s\n", gettype($tmp), $tmp);
+               if (7 !== ($tmp = mysqli_stmt_num_rows($stmt)))
+                       printf("[54] Expecting int/7, got %s/%s\n", gettype($tmp), $tmp);
 
        } else {
                printf("[055] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
index 2979e56667c8c36507b9e9e4c950f71b5e1c7855..947e788635c85a557a15b00fec8d8d5f394c4e57 100644 (file)
@@ -1401,7 +1401,7 @@ static uint64_t
 MYSQLND_METHOD(mysqlnd_res, num_rows)(const MYSQLND_RES * const result TSRMLS_DC)
 {
        /* Be compatible with libmysql. We count row_count, but will return 0 */
-       return result->stored_data? result->stored_data->row_count:0;
+       return result->stored_data? result->stored_data->row_count:(result->unbuf && result->unbuf->eof_reached? result->unbuf->row_count:0);
 }
 /* }}} */