#32882 [Asn->Bgs]: Stored Procedure spoils connection

From: Date: Tue, 03 May 2005 11:20:19 +0000
Subject: #32882 [Asn->Bgs]: Stored Procedure spoils connection
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-78591@lists.php.net to get a copy of this message
ID: 32882 Updated by: georg@php.net Reported By: sales at girderboot dot com -Status: Assigned +Status: Bogus Bug Type: MySQLi related Operating System: Windows Server 2003 PHP Version: 5CVS-2005-04-29 New Comment: . Previous Comments: ------------------------------------------------------------------------ [2005-05-03 09:18:21] georg@php.net Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://www.php.net/manual/ and the instructions on how to report a bug at http://bugs.php.net/how-to-report.php Stored procedures can return more than one resultset, e.g. CREATE PROCEDURE foo() BEGIN SELECT 'foo' FROM DUAL; SELECT 'bar' FROM DUAL; END therefore you should handle resultsets like in mysqli_multi_query (calling mysqli_next_result to clear remaining data on socket). ------------------------------------------------------------------------ [2005-04-29 03:08:15] sales at girderboot dot com Upgraded to latest CVS [5.1.0-dev, Apr 26 2005 04:15:08 ] Still same Problem. ------------------------------------------------------------------------ [2005-04-29 02:45:50] sales at girderboot dot com Description: ------------ After executing a query using a stored procedure that returns a result set, no futher queries can be executed. SProc's that don't return a result set, or embedded SQL queries are not affected (but even they still cannot run after a SP with a result set is run.) MySQL and PHP both version 5.0.4 Reproduce code: --------------- $db = new mysqli('localhost','xxx','xxx','campnet'); if (!$exec = $db->query("CALL Acct_Bal(1)")) echo $db->error; $balance = $exec->fetch_row(); $exec->close(); echo $balance[0]; echo "<BR>"; // Second Time if (!$exec = $db->query("CALL Acct_Bal(1)")) echo $db->error; $balance = $exec->fetch_row(); $exec->close(); echo $balance[0]; Expected result: ---------------- Should Output the same result Twice (In this case, the accout balance): 0.00 0.00 Actual result: -------------- 0.00 Lost connection to MySQL server during query Fatal error: Call to a member function fetch_row() on a non-object in C:\Program Files\Apache Group\Apache2\htdocs\driver.php on line 40 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=32882&edit=1

« previous php.bugs (#78591) next »