php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #32882 Stored Procedure spoils connection
Submitted: 2005-04-29 02:45 UTC Modified: 2005-05-03 13:20 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: sales at girderboot dot com Assigned:
Status: Not a bug Package: MySQLi related
PHP Version: 5CVS-2005-04-29 OS: Windows Server 2003
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
2 + 38 = ?
Subscribe to this entry?

 
 [2005-04-29 02:45 UTC] 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

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-04-29 03:08 UTC] sales at girderboot dot com
Upgraded to latest CVS [5.1.0-dev, Apr 26 2005 04:15:08 ]

Still same Problem.
 [2005-05-03 09:18 UTC] 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). 
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 26 00:01:30 2024 UTC