svn: /php/php-src/ branches/PHP_5_3/NEWS branches/PHP_5_3/ext/mysqlnd/mysqlnd_result.c trunk/ext/mysqlnd/mysqlnd_result.c
| From: | Andrey Hristov | Date: | Mon, 09 Aug 2010 17:29:30 +0000 |
| Subject: | svn: /php/php-src/ branches/PHP_5_3/NEWS branches/PHP_5_3/ext/mysqlnd/mysqlnd_result.c trunk/ext/mysqlnd/mysqlnd_result.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-63250@lists.php.net to get a copy of this message | ||
andrey Mon, 09 Aug 2010 17:29:30 +0000
Revision: http://svn.php.net/viewvc?view=revision&revision=302045
Log:
Fix Request #52302 mysqli_fetch_all does not work with MYSQLI_USE_RESULT
Bug: http://bugs.php.net/52302 (Assigned) mysqli_fetch_all
does not work with MYSQLI_USE_RESULT
Changed paths:
U php/php-src/branches/PHP_5_3/NEWS
U php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_result.c
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 2010-08-09 17:16:43 UTC (rev 302044)
+++ php/php-src/branches/PHP_5_3/NEWS 2010-08-09 17:29:30 UTC (rev 302045)
@@ -13,6 +13,8 @@
empty). (Felipe)
- Fixed bug #52436 (Compile error if systems do not have stdint.h)
(Sriram Natarajan)
+- Fixed bug #52302 (mysqli_fetch_all does not work with MYSQLI_USE_RESULT).
+ (Andrey).
- Fixed bug #51610 (Using oci_connect causes PHP to take a long time to
exit). Requires Oracle bug fix 9891199 for this patch to have an
effect. (Oracle Corp.)
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 2010-08-09 17:16:43 UTC (rev 302044)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_result.c 2010-08-09 17:29:30 UTC (rev 302045)
@@ -1567,8 +1567,7 @@
DBG_ENTER("mysqlnd_res::fetch_all");
DBG_INF_FMT("flags=%u", flags);
- /* mysqlnd_res::fetch_all works with buffered resultsets only */
- if (result->unbuf || (!result->unbuf && !set)) {
+ if ((!result->unbuf && !set)) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "fetch_all can be used only with buffered
sets");
if (result->conn) {
SET_CLIENT_ERROR(result->conn->error_info, CR_NOT_IMPLEMENTED, UNKNOWN_SQLSTATE,
"fetch_all can be used only with buffered sets");
@@ -1577,19 +1576,17 @@
DBG_VOID_RETURN;
}
- mysqlnd_array_init(return_value, (unsigned int) set->row_count);
+ mysqlnd_array_init(return_value, (unsigned int) set? set->row_count : 4); /* 4 is a magic value
*/
- if (!set->row_count || !set->data_cursor || set->data_cursor >= set->data +
set->row_count) {
- DBG_VOID_RETURN;
- }
-
- while (set->data_cursor &&
- (set->data_cursor - set->data) < (set->row_count *
result->meta->field_count))
- {
+ do {
MAKE_STD_ZVAL(row);
mysqlnd_fetch_into(result, flags, row, MYSQLND_MYSQLI);
+ if (Z_TYPE_P(row) != IS_ARRAY) {
+ zval_ptr_dtor(&row);
+ break;
+ }
add_index_zval(return_value, i++, row);
- }
+ } while (1);
DBG_VOID_RETURN;
}
Modified: php/php-src/trunk/ext/mysqlnd/mysqlnd_result.c
===================================================================
--- php/php-src/trunk/ext/mysqlnd/mysqlnd_result.c 2010-08-09 17:16:43 UTC (rev 302044)
+++ php/php-src/trunk/ext/mysqlnd/mysqlnd_result.c 2010-08-09 17:29:30 UTC (rev 302045)
@@ -1567,8 +1567,7 @@
DBG_ENTER("mysqlnd_res::fetch_all");
DBG_INF_FMT("flags=%u", flags);
- /* mysqlnd_res::fetch_all works with buffered resultsets only */
- if (result->unbuf || (!result->unbuf && !set)) {
+ if ((!result->unbuf && !set)) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "fetch_all can be used only with buffered
sets");
if (result->conn) {
SET_CLIENT_ERROR(result->conn->error_info, CR_NOT_IMPLEMENTED, UNKNOWN_SQLSTATE,
"fetch_all can be used only with buffered sets");
@@ -1577,19 +1576,17 @@
DBG_VOID_RETURN;
}
- mysqlnd_array_init(return_value, (unsigned int) set->row_count);
+ mysqlnd_array_init(return_value, (unsigned int) set? set->row_count : 4); /* 4 is a magic value
*/
- if (!set->row_count || !set->data_cursor || set->data_cursor >= set->data +
set->row_count) {
- DBG_VOID_RETURN;
- }
-
- while (set->data_cursor &&
- (set->data_cursor - set->data) < (set->row_count *
result->meta->field_count))
- {
+ do {
MAKE_STD_ZVAL(row);
mysqlnd_fetch_into(result, flags, row, MYSQLND_MYSQLI);
+ if (Z_TYPE_P(row) != IS_ARRAY) {
+ zval_ptr_dtor(&row);
+ break;
+ }
add_index_zval(return_value, i++, row);
- }
+ } while (1);
DBG_VOID_RETURN;
}