]> granicus.if.org Git - php/commitdiff
Fix a bug that a statement that is reset doesn't clean
authorAndrey Hristov <andrey@php.net>
Wed, 17 Mar 2010 18:00:47 +0000 (18:00 +0000)
committerAndrey Hristov <andrey@php.net>
Wed, 17 Mar 2010 18:00:47 +0000 (18:00 +0000)
the wire properly (as it is done when the statement is closed).
If there is more that one result sets returned from the PS
(like a call to SP that returns at least one RSet next to the
status rset) then the line was blocked. PS Multi-Res is not supported
in any libmysql from a GA-ed MySQL.

ext/mysqlnd/mysqlnd_ps.c

index 101d8c4b890440349dbb40a3122140047f684804..563c018ad6f00b04b57503d25875c19efa86ee02 100644 (file)
@@ -1120,16 +1120,18 @@ MYSQLND_METHOD(mysqlnd_stmt, reset)(MYSQLND_STMT * const s TSRMLS_DC)
                  We have to call the appropriate use_result() or store_result() and
                  clean.
                */
-               if (stmt->state == MYSQLND_STMT_WAITING_USE_OR_STORE) {
-                       DBG_INF("fetching result set header");
-                       stmt->default_rset_handler(s TSRMLS_CC);
-                       stmt->state = MYSQLND_STMT_USER_FETCHING;
-               }
+               do {
+                       if (stmt->state == MYSQLND_STMT_WAITING_USE_OR_STORE) {
+                               DBG_INF("fetching result set header");
+                               stmt->default_rset_handler(s TSRMLS_CC);
+                               stmt->state = MYSQLND_STMT_USER_FETCHING;
+                       }
 
-               if (stmt->result) {
-                       DBG_INF("skipping result");
-                       stmt->result->m.skip_result(stmt->result TSRMLS_CC);
-               }
+                       if (stmt->result) {
+                               DBG_INF("skipping result");
+                               stmt->result->m.skip_result(stmt->result TSRMLS_CC);
+                       }
+               } while (mysqlnd_stmt_more_results(s) && mysqlnd_stmt_next_result(s) == PASS);
 
                /*
                  Don't free now, let the result be usable. When the stmt will again be