From:             schwern at pobox dot com
Operating system: OS X
PHP version:      5.2CVS-2009-04-23 (snap)
PHP Bug Type:     MySQLi related
Bug description:  mysqli can not have two called procedure queries active at 
once

Description:
------------
mysqli does not like having two query results active at the same time if a
stored procedure was queried.  MySQL balks with "Commands out of sync; you
can't run this command now".

The equivalent SELECT does not have this problem, nor does Perl's
DBD::mysql for comparison.

Work arounds appear to be explicitly free'ing the result before calling
the next one, but that is not easily possible through the Drupal DB API,
for example.  Also I might want to return a query result from a function
and have it live on out of my function's control.  And its a general
violation of OO to have the two result objects interfere with each other.

Reproduce code:
---------------
http://rafb.net/p/XnP3AN31.html

(Writes to the test database and user)

The script creates a table with a few rows and a stored procedure doing a
"select *" on that table.  It then illustrates that two concurrent calls to
that procedure cause an error while two "SELECT *" queries do not.

Replicated on OS X with their stock PHP 5.2.6 and a fresh
php5.2-200904232230 snapshot with --with-mysqli.

Using a local mysql server compiled from MacPorts.
mysql  Ver 14.12 Distrib 5.0.77, for apple-darwin9.6.0 (i386) using
readline 6.0


Expected result:
----------------
Doing call get_stuff
Done

Doing select * from stuff
Done


Actual result:
--------------
Doing call get_stuff
Second query FAILED: Commands out of sync; you can't run this command now
Done

Doing select * from stuff
Done


-- 
Edit bug report at http://bugs.php.net/?id=48065&edit=1
-- 
Try a CVS snapshot (PHP 5.2):        
http://bugs.php.net/fix.php?id=48065&r=trysnapshot52
Try a CVS snapshot (PHP 5.3):        
http://bugs.php.net/fix.php?id=48065&r=trysnapshot53
Try a CVS snapshot (PHP 6.0):        
http://bugs.php.net/fix.php?id=48065&r=trysnapshot60
Fixed in CVS:                        
http://bugs.php.net/fix.php?id=48065&r=fixedcvs
Fixed in CVS and need be documented: 
http://bugs.php.net/fix.php?id=48065&r=needdocs
Fixed in release:                    
http://bugs.php.net/fix.php?id=48065&r=alreadyfixed
Need backtrace:                      
http://bugs.php.net/fix.php?id=48065&r=needtrace
Need Reproduce Script:               
http://bugs.php.net/fix.php?id=48065&r=needscript
Try newer version:                   
http://bugs.php.net/fix.php?id=48065&r=oldversion
Not developer issue:                 
http://bugs.php.net/fix.php?id=48065&r=support
Expected behavior:                   
http://bugs.php.net/fix.php?id=48065&r=notwrong
Not enough info:                     
http://bugs.php.net/fix.php?id=48065&r=notenoughinfo
Submitted twice:                     
http://bugs.php.net/fix.php?id=48065&r=submittedtwice
register_globals:                    
http://bugs.php.net/fix.php?id=48065&r=globals
PHP 4 support discontinued:          http://bugs.php.net/fix.php?id=48065&r=php4
Daylight Savings:                    http://bugs.php.net/fix.php?id=48065&r=dst
IIS Stability:                       
http://bugs.php.net/fix.php?id=48065&r=isapi
Install GNU Sed:                     
http://bugs.php.net/fix.php?id=48065&r=gnused
Floating point limitations:          
http://bugs.php.net/fix.php?id=48065&r=float
No Zend Extensions:                  
http://bugs.php.net/fix.php?id=48065&r=nozend
MySQL Configuration Error:           
http://bugs.php.net/fix.php?id=48065&r=mysqlcfg

Reply via email to