|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #38842 PDO nextRowset not working on MySQL
Submitted: 2006-09-15 11:20 UTC Modified: 2008-07-03 12:39 UTC
Avg. Score:5.0 ± 0.0
Reproduced:1 of 2 (50.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: stochnagara at hotmail dot com Assigned:
Status: Closed Package: Feature/Change Request
PHP Version: 5CVS-2006-09-15 (snap) OS: windows xp
Private report: No CVE-ID: None
 [2006-09-15 11:20 UTC] stochnagara at hotmail dot com
Calling nextRowset on PDOStatement generates an error.

Reproduce code:
$pdo = new PDO ('mysql:...');
$q = $pdo->query ("CALL some_proc");

or for example

$pdo = new PDO ('mysql:...');
$q = $pdo->query ("SELECT 1; SELECT 2;");

Expected result:
No errors.

Actual result:
Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[HYC00]: Optional feature not implemented' in ...


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2006-09-18 06:35 UTC] stochnagara at hotmail dot com
Sorry, this is not a feature request but a PDO related bug.
 [2006-09-18 07:35 UTC]
"Optional feature not implemented" means this functionality is not yet available. Which in turn means it's feature request.
 [2006-10-17 16:03 UTC] mike at we11er dot co dot uk
IMO this is a bug. If a stored procedure is called, it returns multiple row sets, one for each query inside it that returns results, and one for the return status.

Because all the results from a statement must be fetched before subsequent statements can be made, we NEED nextRowset to work otherwise the following error is received:

PDOStatement::nextRowset() [function.PDOStatement-nextRowset]: SQLSTATE[HYC00]: Optional feature not implemented

closeCursor() does not work when multiple rowsets are present.
 [2006-10-17 16:04 UTC] mike at we11er dot co dot uk
Err, sorry... that last error should be:

PDOStatement::execute() [function.PDOStatement-execute]: SQLSTATE[HY000]: General error: 2013 Lost connection to MySQL server during query
 [2006-12-04 17:45 UTC] mike at we11er dot co dot uk
 [2008-07-03 12:32 UTC]
Wait for PDO_MYSQLND and try again. Should be fixed.

Note that multi-statement contradicts the PDO idea of a "secure" driver. Enabling multi-statement by default means opening all doors for SQL injections!
 [2008-07-03 12:39 UTC]
Let's close this. This is a duplicate of many other reports such as:

#41997  	pdo_mysql: stored procedure call returning single rowset blocks future queries
Bug #39759  	Can't use stored procedures from PDO on Windows
PECL Bug #12794  	PDOStatement->nextRowset() doesn't work

PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Sun Oct 01 16:01:24 2023 UTC