PROCEDURE db.myproc can't return a result set in the given context
| Bug #50416 | PROCEDURE db.myproc can't return a result set in the given context | |||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Submitted: | 2009-12-08 20:28 UTC | Modified: | 2010-02-08 13:10 UTC |
|
||||||||||
| From: | ernesto_vargas at yahoo dot com | Assigned: | mysql (profile) | |||||||||||
| Status: | Closed | Package: | MySQL related | |||||||||||
| PHP Version: | 5.3, 6 | OS: | * | |||||||||||
| Private report: | No | CVE-ID: | None | |||||||||||
[2009-12-08 20:28 UTC] ernesto_vargas at yahoo dot com
Description:
------------
Any call to a mysql stored procedure produces the following error:
"PROCEDURE database.store_proc_name can't return a result set in the given context"
When calling the stored procedure from mysql cli client do return the results correctly.
Tested against MySql 5.0 and 5.1.
Work on php-5.2.9 but not on php-5.3.0 or php-5.3.1
Reproduce code:
---------------
DELIMITER $$
CREATE PROCEDURE `myproc`()
BEGIN
SELECT 'it works!';
END$$
<?php
$link = mysql_connect('127.0.0.1','root','',false,65536);
if (!$link) {
die('Could not connect: ' . mysql_error());
}
$db_selected = mysql_select_db('test', $link);
if (!$db_selected) {
die ('Can\'t use maxdb : ' . mysql_error());
}
$query = 'CALL myproc();';
$result = mysql_query($query);
if (!$result) {
$message = 'Invalid query: ' . mysql_error() . "\n";
$message .= 'Whole query: ' . $query;
die($message);
}
$row = mysql_fetch_row($result);
var_dump($row);
mysql_free_result($result);
mysql_close($link);
Expected result:
----------------
array(1) {
["it works!"]=>
string(9) "it works!"
}
Actual result:
--------------
Warning: mysql_query(): PROCEDURE test.myproc can't return a result set in the given context in /home/html/sp_test.php on line 11
Invalid query: PROCEDURE test.myproc can't return a result set in the given context
Whole query: CALL myproc();
Patches
Pull Requests
History
AllCommentsChangesGit/SVN commits
[2009-12-08 22:44 UTC] ermesto_vargas at yahoo dot com
[2009-12-17 08:23 UTC] jani@php.net
[2010-01-05 14:53 UTC] ernesto_vargas at yahoo dot com
[2010-01-07 10:16 UTC] jani@php.net
[2010-01-12 21:11 UTC] ermesto_vargas at yahoo dot com
[2010-01-28 23:32 UTC] ermesto_vargas at yahoo dot com
[2010-02-08 11:41 UTC] andrey@php.net
andrey@winnie:~/dev/php/PHP_5_3$ ./php a.php string(6) "5.1.44" array(1) { [0]=> string(9) "it works!" } This is a mysqlnd build, with libmysql I see the error message. This will be further investigated.[2010-02-08 13:10 UTC] andrey@php.net