ID:               39858
 Comment by:       mgrdinic at sledxchange dot com
 Reported By:      develar at gmail dot com
 Status:           Assigned
 Bug Type:         PDO related
 Operating System: Windows XP SP2
 PHP Version:      5.2.0
 Assigned To:      wez
 New Comment:

One last thing:

It should be noted that you can "workaround" this issue by simply
instantiating a whole new PDO object after every call that returns a
result set.

// create a PDO instance up here somewhere and perform your query...

// get the return values you need...
$result = $sth->fetchAll ();

// and just create a new object...
try {
        $dbh = new PDO ( $dsn, $user, $pass );
        $dbh->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, 1);
        $dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING);
} catch ( PDOException $e ) {
        die ( 'PDO Connection Failed: ' . $e->getMessage () );
}

// now you can query again without the error. 


It seem like the solution is simple to do. In fact, this guy seems to
be on the right track:
http://bugs.php.net/bug.php?id=42499

Why isn't this done!

Oh well, hopefully the above, if not totally wrong : ) will help
someone else.


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

[2008-04-05 20:53:08] mgrdinic at sledxchange dot com

Same problem here-I'm on Vista Ultimate SP1 and IIS 7 MySQL 5.0.45

The trick is regular NON-Select queries work as expected. It's when
your Stored Procedures return result sets the problems show up. 

So for example, if the first query performs a one off select and
closes, the second query is hit with the "SQLSTATE[HY000]: General
error: 2014 Cannot execute queries while other unbuffered queries are
active error". And yes, that's with using the fetchAll.

However, if I remove the select statement from the first procedure and
run the code again, both stored procedures work fine.  

I've tried the latest snap-shots, but unfortunately I couldn't get pdo
to even load. Any ideas? Updates?

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

[2008-04-05 16:56:25] php at pofik dot com

Hi there - so is there a proper fix for this by now? I just started
using stored procedures more extensively and I am now hit by this bug
all the time (Windows XP SP2, MySQL 5.0.51a, PHP 5.2.1)! Apparently this
bug is a known problem since at least October 2005 (Bug #5827), so I'd
think this should be long fixed?? However, I cannot locate any
information on a proper fix except for a bunch of makeshift workarounds
(using ODBC, abandoning the connection on HY000 etc.), and tons of
people complaining about it not being fixed. 

Considering how long this bug is known and open, it would help if
someone could post some update. This issue is really really annoying.

Thanks!

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

[2008-02-07 12:57:17] kraus at phoenix-medien dot de

This PDO bug makes it impossible to install Magento on Windows
platforms. See
http://www.magentocommerce.com/wiki/general/installing_on_windows_with_xampp_and_wamp
for further information.

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

[2007-12-17 08:33:59] poon dot fung at gmail dot com

Same problem presist on Windows XP with PHP v5.2.5. Again, here is the
error message. When a query is executed after calling a stored
procedure.

code: HY000, msg: 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.

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

[2007-09-12 15:20:56] timo at hhesse dot de

Well, months pass by and nothing happens... ;-(

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

The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
    http://bugs.php.net/39858

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

Reply via email to