]> 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).

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

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 68331aa2ecacd508e0fd9ad4d08e1ccd40a82d45..93bb8b1a682984e6202796e19ebb0abbe962c863 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);
 }
 /* }}} */