|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2007-09-03 09:15 UTC] jani@php.net
[2007-09-03 18:58 UTC] suhachov at gmail dot com
[2007-09-03 19:00 UTC] suhachov at gmail dot com
[2007-09-04 10:36 UTC] jani@php.net
[2007-09-04 14:42 UTC] suhachov at gmail dot com
[2007-09-04 14:45 UTC] jani@php.net
[2008-04-05 21:06 UTC] mgrdinic at sledxchange dot com
[2008-04-29 14:43 UTC] kingoleg at mail dot ru
[2008-05-08 14:58 UTC] johannes@php.net
[2008-05-22 19:53 UTC] uw@php.net
[2008-07-22 14:40 UTC] uw@php.net
[2008-07-30 01:00 UTC] php-bugs at lists dot php dot net
[2008-11-05 09:21 UTC] stormi at laposte dot net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Nov 22 06:00:01 2025 UTC |
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)