summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrey Hristov <andrey@php.net>2011-02-16 16:36:33 +0000
committerAndrey Hristov <andrey@php.net>2011-02-16 16:36:33 +0000
commit1bdc780d30450593c1289845e95e9749ff38181a (patch)
treeba2c3854738e5dbf8861e5768a766fff1d2926f0
parentd41c8bd74a3d5da642b3651dc80d5475f04b95b1 (diff)
downloadphp-git-1bdc780d30450593c1289845e95e9749ff38181a.tar.gz
fixed a problem in mysqlnd. 0 was always as num_rows returned for
unbuffered sets (text protocol and PS).
-rw-r--r--NEWS4
-rw-r--r--ext/mysqli/tests/mysqli_stmt_num_rows.phpt4
-rw-r--r--ext/mysqlnd/mysqlnd_result.c2
3 files changed, 7 insertions, 3 deletions
diff --git a/NEWS b/NEWS
index cef3f418f7..49b929ec41 100644
--- a/NEWS
+++ b/NEWS
@@ -87,6 +87,10 @@
. 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)
diff --git a/ext/mysqli/tests/mysqli_stmt_num_rows.phpt b/ext/mysqli/tests/mysqli_stmt_num_rows.phpt
index 0a21bb5471..af81ca4e8a 100644
--- a/ext/mysqli/tests/mysqli_stmt_num_rows.phpt
+++ b/ext/mysqli/tests/mysqli_stmt_num_rows.phpt
@@ -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));
diff --git a/ext/mysqlnd/mysqlnd_result.c b/ext/mysqlnd/mysqlnd_result.c
index 2979e56667..947e788635 100644
--- a/ext/mysqlnd/mysqlnd_result.c
+++ b/ext/mysqlnd/mysqlnd_result.c
@@ -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);
}
/* }}} */