andrey Wed, 16 Feb 2011 16:36:33 +0000
Revision: http://svn.php.net/viewvc?view=revision&revision=308394
Log:
fixed a problem in mysqlnd. 0 was always as num_rows returned for
unbuffered sets (text protocol and PS).
Changed paths:
U php/php-src/branches/PHP_5_3/NEWS
U php/php-src/branches/PHP_5_3/ext/mysqli/tests/mysqli_stmt_num_rows.phpt
U php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_result.c
U php/php-src/trunk/ext/mysqli/tests/mysqli_stmt_num_rows.phpt
U php/php-src/trunk/ext/mysqlnd/mysqlnd_result.c
Modified: php/php-src/branches/PHP_5_3/NEWS
===================================================================
--- php/php-src/branches/PHP_5_3/NEWS 2011-02-16 16:06:29 UTC (rev 308393)
+++ php/php-src/branches/PHP_5_3/NEWS 2011-02-16 16:36:33 UTC (rev 308394)
@@ -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)
Modified:
php/php-src/branches/PHP_5_3/ext/mysqli/tests/mysqli_stmt_num_rows.phpt
===================================================================
--- php/php-src/branches/PHP_5_3/ext/mysqli/tests/mysqli_stmt_num_rows.phpt
2011-02-16 16:06:29 UTC (rev 308393)
+++ php/php-src/branches/PHP_5_3/ext/mysqli/tests/mysqli_stmt_num_rows.phpt
2011-02-16 16:36:33 UTC (rev 308394)
@@ -82,8 +82,8 @@
$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));
Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_result.c
===================================================================
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_result.c 2011-02-16
16:06:29 UTC (rev 308393)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_result.c 2011-02-16
16:36:33 UTC (rev 308394)
@@ -1401,7 +1401,7 @@
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);
}
/* }}} */
Modified: php/php-src/trunk/ext/mysqli/tests/mysqli_stmt_num_rows.phpt
===================================================================
--- php/php-src/trunk/ext/mysqli/tests/mysqli_stmt_num_rows.phpt
2011-02-16 16:06:29 UTC (rev 308393)
+++ php/php-src/trunk/ext/mysqli/tests/mysqli_stmt_num_rows.phpt
2011-02-16 16:36:33 UTC (rev 308394)
@@ -82,8 +82,8 @@
$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));
Modified: php/php-src/trunk/ext/mysqlnd/mysqlnd_result.c
===================================================================
--- php/php-src/trunk/ext/mysqlnd/mysqlnd_result.c 2011-02-16 16:06:29 UTC
(rev 308393)
+++ php/php-src/trunk/ext/mysqlnd/mysqlnd_result.c 2011-02-16 16:36:33 UTC
(rev 308394)
@@ -1401,7 +1401,7 @@
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);
}
/* }}} */
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php