andrey                                   Mon, 06 Dec 2010 13:59:14 +0000

Revision: http://svn.php.net/viewvc?view=revision&revision=306009

Log:
Skip additional result sets sent by MySQL 5.5 servers
which break the Protocol API
(see http://bugs.mysql.com/bug.php?id=58700)

Changed paths:
    U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_ps.c
    U   php/php-src/trunk/ext/mysqlnd/mysqlnd_ps.c

Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_ps.c
===================================================================
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_ps.c       2010-12-06 
13:50:51 UTC (rev 306008)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_ps.c       2010-12-06 
13:59:14 UTC (rev 306009)
@@ -225,10 +225,15 @@
                DBG_RETURN(FAIL);
        }

+       DBG_INF_FMT("server_status=%u cursor=%u", 
stmt->upsert_status.server_status, stmt->upsert_status.server_status & 
SERVER_STATUS_CURSOR_EXISTS);
+       DBG_INF_FMT("server_status=%u cursor=%u", 
conn->upsert_status.server_status, conn->upsert_status.server_status & 
SERVER_STATUS_CURSOR_EXISTS);
+
        /* Free space for next result */
        s->m->free_stmt_content(s TSRMLS_CC);
-
-       DBG_RETURN(s->m->parse_execute_response(s TSRMLS_CC));
+       {
+               enum_func_status ret = s->m->parse_execute_response(s 
TSRMLS_CC);
+               DBG_RETURN(ret);
+       }
 }
 /* }}} */

@@ -556,6 +561,14 @@
                        }
                }
        }
+#ifndef MYSQLND_DONT_SKIP_OUT_PARAMS_RESULTSET
+       if (stmt->upsert_status.server_status & SERVER_PS_OUT_PARAMS) {
+               s->m->free_stmt_content(s TSRMLS_CC);
+               DBG_INF("PS OUT Variable RSet, skipping");
+               /* OUT params result set. Skip for now to retain compatibility 
*/
+               ret = mysqlnd_stmt_execute_parse_response(s TSRMLS_CC);
+       }
+#endif

        DBG_INF(ret == PASS? "PASS":"FAIL");
        DBG_RETURN(ret);
@@ -701,6 +714,8 @@

        ret = s->m->parse_execute_response(s TSRMLS_CC);

+       DBG_INF_FMT("server_status=%u cursor=%u", 
stmt->upsert_status.server_status, stmt->upsert_status.server_status & 
SERVER_STATUS_CURSOR_EXISTS);
+
        if (ret == PASS && conn->last_query_type == QUERY_UPSERT && 
stmt->upsert_status.affected_rows) {
                MYSQLND_INC_CONN_STATISTIC_W_VALUE(conn->stats, 
STAT_ROWS_AFFECTED_PS, stmt->upsert_status.affected_rows);
        }

Modified: php/php-src/trunk/ext/mysqlnd/mysqlnd_ps.c
===================================================================
--- php/php-src/trunk/ext/mysqlnd/mysqlnd_ps.c  2010-12-06 13:50:51 UTC (rev 
306008)
+++ php/php-src/trunk/ext/mysqlnd/mysqlnd_ps.c  2010-12-06 13:59:14 UTC (rev 
306009)
@@ -225,10 +225,15 @@
                DBG_RETURN(FAIL);
        }

+       DBG_INF_FMT("server_status=%u cursor=%u", 
stmt->upsert_status.server_status, stmt->upsert_status.server_status & 
SERVER_STATUS_CURSOR_EXISTS);
+       DBG_INF_FMT("server_status=%u cursor=%u", 
conn->upsert_status.server_status, conn->upsert_status.server_status & 
SERVER_STATUS_CURSOR_EXISTS);
+
        /* Free space for next result */
        s->m->free_stmt_content(s TSRMLS_CC);
-
-       DBG_RETURN(s->m->parse_execute_response(s TSRMLS_CC));
+       {
+               enum_func_status ret = s->m->parse_execute_response(s 
TSRMLS_CC);
+               DBG_RETURN(ret);
+       }
 }
 /* }}} */

@@ -556,6 +561,14 @@
                        }
                }
        }
+#ifndef MYSQLND_DONT_SKIP_OUT_PARAMS_RESULTSET
+       if (stmt->upsert_status.server_status & SERVER_PS_OUT_PARAMS) {
+               s->m->free_stmt_content(s TSRMLS_CC);
+               DBG_INF("PS OUT Variable RSet, skipping");
+               /* OUT params result set. Skip for now to retain compatibility 
*/
+               ret = mysqlnd_stmt_execute_parse_response(s TSRMLS_CC);
+       }
+#endif

        DBG_INF(ret == PASS? "PASS":"FAIL");
        DBG_RETURN(ret);
@@ -701,6 +714,8 @@

        ret = s->m->parse_execute_response(s TSRMLS_CC);

+       DBG_INF_FMT("server_status=%u cursor=%u", 
stmt->upsert_status.server_status, stmt->upsert_status.server_status & 
SERVER_STATUS_CURSOR_EXISTS);
+
        if (ret == PASS && conn->last_query_type == QUERY_UPSERT && 
stmt->upsert_status.affected_rows) {
                MYSQLND_INC_CONN_STATISTIC_W_VALUE(conn->stats, 
STAT_ROWS_AFFECTED_PS, stmt->upsert_status.affected_rows);
        }

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to