|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2006-12-06 17:09 UTC] mike at we11er dot co dot uk
Description:
------------
On the windows version of pdo_mysql, the nextRowset() method isn't implemented for PDOStatement.
This means that when executing a stored procedure, it is impossible to fetch all result sets, because all stored procedures return multiple result sets (one contains a return value of some sort).
Because you can't fetch all result sets, all subsequent queries are broken, with the following error/exception:
SQLSTATE[HY000]: General error: 2014 Cannot execute queries while other unbuffered queries are active. Consider using PDOStatement::fetchAll().
nextRowset() is /required/ to properly use stored procedures.
Reproduce code:
---------------
It should be possible to fetch all results from a stored procedure with code like this:
$stmt = $db->prepare("CALL SomeProcedure()");
$stmt->execute();
do
{
$stmt->fetchAll();
} while ($stmt->nextRowset());
Intead the error message:
SQLSTATE[HYC00]: Optional feature not implemented
Is displayed. But I don't see how this can be optional in this case, it is required.
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Oct 27 18:00:01 2025 UTC |
I'm sorry to reopen again, but I think the "optional feature not implemented" is just wrong. That would imply that stored procedures are an optional feature. If so, then that is unnacceptable. I have some code to reproduce the error: <?php /* CREATE PROCEDURE Test() BEGIN SELECT 0; SELECT 1; END */ class DBWriter extends PDO { public function __construct() { try { parent::__construct("mysql:host=localhost;dbname=test","user", "password"); $this->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); } catch (PDOException $e) { throw new Exception("Failed to connect: " . $e->getMessage()); } } } $db = new DBWriter(); $stmt = $db->prepare("CALL Test()"); $stmt->execute(); $stmt->fetchAll(); // run the query again and we get an error "Cannot execute queries while other unbuffered queries are active." // but we can't fetch all results from the previous query because nextRowset isn't defined $stmt->execute(); ?> I just want the status of this to be elevated - I think "feature request" is just plain wrong. I want to hear an official opinion on this...