ID:               42499
 User updated by:  suhachov at gmail dot com
 Reported By:      suhachov at gmail dot com
-Status:           Feedback
+Status:           Open
 Bug Type:         PDO related
 Operating System: FC
 PHP Version:      5.2.4
 New Comment:

How about _you_ check this issue instead of brushing aside?
This bug is reproduced with ANY versions of PHP (5.1.6 - 5.2.4)


Previous Comments:
------------------------------------------------------------------------

[2007-09-03 09:15:32] [EMAIL PROTECTED]

You report the bug with version 5.2.4, yet you seem to be using
5.1.6?!
How about you try with 5.2.4 first?

------------------------------------------------------------------------

[2007-08-31 16:00:05] suhachov at gmail dot com

Description:
------------
$dbh = PDO('mysql:...',...);
$dbh->exec("SET some_var='value';SET names 'utf8'");
$dbh->query("SELECT NOW()");
# Error: Cannot execute queries while other unbuffered queries are
active. ... 

PDO::MYSQL_ATTR_USE_BUFFERED_QUERY doesn't help.

I found that in mysql_handle_doer() multi-results aren't freed. 
I'm not a MySQL C API professional, but this patch seems to solve this
problem:

--- php-5.1.6/ext/pdo_mysql/mysql_driver.c      2007-08-31
19:47:15.000000000 +0400
+++ php-5.1.6/ext/pdo_mysql/mysql_driver.c      2007-08-31
19:50:09.000000000 +0400
@@ -243,36 +243,20 @@
 
 static long mysql_handle_doer(pdo_dbh_t *dbh, const char *sql, long
sql_len TSRMLS_DC)
 {
-       int ret_val;
        pdo_mysql_db_handle *H = (pdo_mysql_db_handle *)dbh->driver_data;
 
        if (mysql_real_query(H->server, sql, sql_len)) {
                pdo_mysql_error(dbh);
-               ret_val = -1;
+               return -1;
        } else {
-               //  !!
                my_ulonglong c = mysql_affected_rows(H->server);
                if (c == (my_ulonglong) -1) {
                        pdo_mysql_error(dbh);
-                       ret_val =  (H->einfo.errcode ? -1 : 0);
+                       return (H->einfo.errcode ? -1 : 0);
                } else {
-                       ret_val =  c;
-               }
+                       return c;
        }
-
-#if HAVE_MYSQL_NEXT_RESULT
-       while (mysql_more_results(H->server)) {
-               MYSQL_RES *res;
-               if (mysql_next_result(H->server) != 0) {
-                       break;
                }
-               res = mysql_store_result(H->server);
-               if (res) {
-                       mysql_free_result(res);
-               }
-       }
-#endif
-       return ret_val;
 }
 
 static char *pdo_mysql_last_insert_id(pdo_dbh_t *dbh, const char
*name, unsigned int *len TSRMLS_DC)




------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=42499&edit=1

Reply via email to