Req #36157 [Opn->Fbk]: Introduce new PDO attribute to automatically close old statement.

From: Date: Thu, 09 Sep 2021 12:32:14 +0000
Subject: Req #36157 [Opn->Fbk]: Introduce new PDO attribute to automatically close old statement.
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-236491@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=36157&edit=1 ID: 36157 Updated by: cmb@php.net Reported by: fh at ez dot no Summary: Introduce new PDO attribute to automatically close old statement. -Status: Open +Status: Feedback Type: Feature/Change Request Package: PDO related Operating System: Gentoo Linux PHP Version: 5.1.2 -Assigned To: +Assigned To: cmb Block user comment: N Private report: N New Comment: Is this even still an issue with any of the actively supported PHP versions[1]? [1] <https://www.php.net/supported-versions.php> Previous Comments: ------------------------------------------------------------------------ [2006-01-25 16:59:30] fh at ez dot no Description: ------------ Currently when using the MySQL PDO driver, trying to execute a second statement while the first one is still active yields: SQLSTATE[HY000]: General error: 2014 Cannot execute queries while other unbuffered queries are active.Consider using PDOStatement::fetchAll(). Alternatively, if your code is only ever going to run against mysql, you may enable query buffering by setting the PDO::MYSQL_ATTR_USE_BUFFERED_QUERY attribute. This is all well and good, but quite unhandy since it is inconsistent with e.g the postgres driver that does not suffer from this problem. It also makes it very hard e.g wrap the result of an SQL statement in an iterator since the user might break out of it. I propose to introduce a new attribute to PDO that force the drivers to automatically "flush" any open statements when a new one is executed. ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=36157&edit=1

« previous php.bugs (#236491) next »