]> granicus.if.org Git - php/commitdiff
Fix a small bug that mysqlnd::next_result didn't care about an error in a
authorAndrey Hristov <andrey@php.net>
Wed, 19 Nov 2008 17:41:25 +0000 (17:41 +0000)
committerAndrey Hristov <andrey@php.net>
Wed, 19 Nov 2008 17:41:25 +0000 (17:41 +0000)
multi-statement. In an inner layer the error has been already set, thus it
needed better massage on the top level.

ext/mysqlnd/mysqlnd.c

index 269cfc5cc3d8fda8ce84a38dcccfffc37ff5ef87..b0c44748a20dd325401213ac61521c28dcfb61ae 100644 (file)
@@ -1733,9 +1733,17 @@ MYSQLND_METHOD(mysqlnd_conn, next_result)(MYSQLND * const conn TSRMLS_DC)
          in mysqlnd_store_result() or mysqlnd_fetch_row_unbuffered()
        */
        if (FAIL == (ret = mysqlnd_query_read_result_set_header(conn, NULL TSRMLS_CC))) {
-               DBG_ERR_FMT("Serious error. %s::%d", __FILE__, __LINE__);
-               php_error_docref(NULL TSRMLS_CC, E_WARNING, "Serious error. PID=%d", getpid());
-               CONN_SET_STATE(conn, CONN_QUIT_SENT);
+               /*
+                 There can be an error in the middle of a multi-statement, which will cancel the multi-statement.
+                 So there are no more results and we should just return FALSE, error_no has been set
+               */
+               if (!conn->error_info.error_no) {
+                       DBG_ERR_FMT("Serious error. %s::%d", __FILE__, __LINE__);
+                       php_error_docref(NULL TSRMLS_CC, E_WARNING, "Serious error. PID=%d", getpid());
+                       CONN_SET_STATE(conn, CONN_QUIT_SENT);
+               } else {
+                       DBG_INF_FMT("Error from the server : (%d) %s", conn->error_info.error_no, conn->error_info.error);
+               }
        }
 
        DBG_RETURN(ret);