|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[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();
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Nov 01 21:00:01 2025 UTC |
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.