]> granicus.if.org Git - php/commitdiff
Fixed bug #39759 (Can't use stored procedures fetching multiple result
authorIlia Alshanetsky <iliaa@php.net>
Fri, 8 Dec 2006 19:50:40 +0000 (19:50 +0000)
committerIlia Alshanetsky <iliaa@php.net>
Fri, 8 Dec 2006 19:50:40 +0000 (19:50 +0000)
sets in pdo_mysql).

NEWS
ext/pdo/pdo_stmt.c
ext/pdo_mysql/mysql_driver.c
ext/pdo_mysql/mysql_statement.c
ext/pdo_mysql/tests/pecl_bug_5780.phpt

diff --git a/NEWS b/NEWS
index 69ce1a7887078e7e2ce12a7a48ffffaf6f475ab4..21918c3f2b9f5cb67d3493ce168b2f746b31a0b2 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -52,6 +52,8 @@ PHP                                                                        NEWS
 - Fixed bug #39775 ("Indirect modification ..." message is not shown). (Dmitry)
 - Fixed bug #39763 (magic quotes are applied twice by ext/filter in
   parse_str()). (Ilia) 
+- Fixed bug #39759 (Can't use stored procedures fetching multiple result
+  sets in pdo_mysql). (Ilia)
 - Fixed bug #39754 (Some POSIX extension functions not thread safe).
   (Ilia, wharmby at uk dot ibm dot com)
 - Fixed bug #39724 (Broken build due to spl/filter usage of pcre extension).
index 16555c8c9f53c4e1e2c1f2284fbe05fcba35d157..61e3c9f3e8be9b91f46ec6307a5880e8d107b579 100755 (executable)
@@ -1932,10 +1932,6 @@ static PHP_METHOD(PDOStatement, setFetchMode)
 
 static int pdo_stmt_do_next_rowset(pdo_stmt_t *stmt TSRMLS_DC)
 {
-       if (!stmt->methods->next_rowset(stmt TSRMLS_CC)) {
-               return 0;
-       }
-
        /* un-describe */
        if (stmt->columns) {
                int i;
@@ -1949,6 +1945,10 @@ static int pdo_stmt_do_next_rowset(pdo_stmt_t *stmt TSRMLS_DC)
                stmt->column_count = 0;
        }
 
+       if (!stmt->methods->next_rowset(stmt TSRMLS_CC)) {
+               return 0;
+       }
+
        pdo_stmt_describe_columns(stmt TSRMLS_CC);
 
        return 1;
@@ -1969,8 +1969,6 @@ static PHP_METHOD(PDOStatement, nextRowset)
                PDO_HANDLE_STMT_ERR();
                RETURN_FALSE;
        }
-       
-       pdo_stmt_describe_columns(stmt TSRMLS_CC);
 
        RETURN_TRUE;
 }
index 01a9b19fa606cbb942efa1f05cbefd80a0d88294..53a9fb76e33f5ba9f17bf3fb39e5ff34cfe38b0e 100755 (executable)
@@ -471,7 +471,7 @@ static int pdo_mysql_handle_factory(pdo_dbh_t *dbh, zval *driver_options TSRMLS_
        
        dbh->driver_data = H;
        H->max_buffer_size = 1024*1024;
-       H->emulate_prepare = 1;
+       H->buffered = H->emulate_prepare = 1;
 
        /* handle MySQL options */
        if (driver_options) {
index 856b23286cb8858d0093ed30f736997c11d8eed2..8605bad9c044897127abc2f877b2453037e1537d 100755 (executable)
@@ -273,15 +273,15 @@ static int pdo_mysql_stmt_next_rowset(pdo_stmt_t *stmt TSRMLS_DC)
                /* No more results */
                return 0;
        } else {
-               if ((my_ulonglong)-1 == (row_count = mysql_affected_rows(H->server))) {
-                       pdo_mysql_error_stmt(stmt);
-                       return 0;
-               }
-               
                if (!H->buffered) {
                        S->result = mysql_use_result(H->server);
+                       row_count = 0;
                } else {
                        S->result = mysql_store_result(H->server);
+                       if ((my_ulonglong)-1 == (row_count = mysql_affected_rows(H->server))) {
+                               pdo_mysql_error_stmt(stmt);
+                               return 0;
+                       }
                }
 
                if (NULL == S->result) {
index ef94db13cc02b417bf50f5439c8b6d2f02609548..e6b79a1daae589c2b71ffa4b3d1f0633d9daee5f 100644 (file)
@@ -33,10 +33,8 @@ array(2) {
   [1]=>
   string(7) "testing"
 }
-bool(false)
-array(2) {
+bool(true)
+array(1) {
   [0]=>
-  string(5) "HY000"
-  [1]=>
-  int(2014)
+  string(5) "00000"
 }