|   | php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login | 
| 
  [2006-05-26 17:09 UTC] randall dot carlson at navy dot mil
 Description:
------------
It appears the PDO execute is hanging when a MySQL stored procedure is called. The same code works fine on PHP 5.1.2 & MySQL 4.0.21.  Once we upgraded to 5.1.4, the problem began.  It looks as if the call is being executed a couple of times in the MySQL queries.log.  Our application code has many such calls and after attempting to execute each one the browser eventually timesout.
When I subtitute the SQL statment in the prepare, it comes back fine.
Reproduce code:
---------------
create procedure pdo_test() begin select dummy from dummy; end;
$pdo = new PDO("mysql:host=localhost;dbname=x","x","x");
$stmt = $pdo->prepare("call pdo_test()"/*"select dummy from dummy;"*/);
$stmt->execute();
echo "<B>outputting...</B><BR>";
while ($rs = $stmt->fetch(PDO::FETCH_OBJ)) {
	echo "output: ".$rs->dummy."<BR>";
}
echo "<BR><B>".date("r")."</B>";
Expected result:
----------------
should get 
outputting...
output: 1
Fri, 26 May 2006 13:02:17 -0400
Actual result:
--------------
timeout
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits             | |||||||||||||||||||||||||||||||||||||
|  Copyright © 2001-2025 The PHP Group All rights reserved. | Last updated: Fri Oct 31 06:00:01 2025 UTC | 
Well, my problem involves database access with PDO, so I don't know how to convey the problem without a database. As far as the script itself: <?php $pdo = new PDO("mysql:host=localhost;dbname=x","x","x"); $stmt = $pdo->prepare("call pdo_test()"/*"select dummy from dummy;"*/); $stmt->execute(); echo "<B>outputting...</B><BR>"; while ($rs = $stmt->fetch(PDO::FETCH_OBJ)) { echo "output: ".$rs->dummy."<BR>"; } echo "<BR><B>".date("r")."</B>"; ?> That is all of it, except for the MySQL stored procedure script: create procedure pdo_test() begin select dummy from dummy; end;Facing same problem with 5.1.4 on FreeBSD 5.1 and MySQL 5.1.11. Code extract below: function getOMXDailySnapshot($submarkets_id) { $db = Zend::registry('db'); $stm = $db->prepare('CALL omx_daily_snapshot(:submarket_id)'); $stm->bindValue('submarket_id',$submarkets_id); $stm->execute(); $result = $stm->fetchAll(); return $result; } It seems to me that it is somehow related to result set length.